replace has some issues and still needs improvement
askfiy opened this issue · 4 comments
This problem is not just with translate_shell, google also adds some extra spaces.
Frankly, I don't think the first one is a practical problem, but I would like to address the translation of paths, as it is something that could well happen in actual use. Would using {@C@}
be a complete solution?
This problem is not just with translate_shell, google also adds some extra spaces.
As for command/google, I think it can be translated without replace.
First of all, when I found this problem, I was thinking why this happened.
trans
uses the Google API
by default, which randomly inserts extra spaces in the translation result, so the {{@C@}}
is split.
////////
│
▼
replace before
│
▼
{{@C@}}{{@C@}}{{@C@}}{{@C@}}{{@C@}}{{@C@}}{{@C@}}{{@C@}}
│
▼
trans (the problem is upstream, random spaces are added)
│
▼
{{@C@}}{{@C@}} {{@C@}}{{@C@}} {{@C@}}{ {@C@}}{{@C@}}{{@C@}}
│
▼
result after
│
▼
// // / { {@C@}}//
To verify if this issue was caused by Google API
randomly inserted spaces, I tried again using the plugin's default Google
to try the translation.
//////////////////////
│
▼
google
│
▼
////////////// ///////
Good job, randomly inserted spaces This question comes from Google API
。
Is there any way to solve it? Essentially no, because we're not sure where random spaces will be added.
The only thing that can be done is to reduce the length of the placeholder to make it simpler.
So {@C@}
works better than {{@C@}}
.
in conclusion:
{@C@}
works better than{{@C@}}
- This issue is caused by
**randomly inserted spaces**
inGoogle API
(which is used internally bytranslate-shell
)