bbepis / XUnity.AutoTranslator

MIT License
1.99k stars 293 forks source link

ZMCZ translated in case of target language other than English #584

Open TokcDK opened 2 months ago

TokcDK commented 2 months ago

The plugin is changing cache substitution replacer like {{A}} with ZMCZ or kind of for online service and in case when target language is not English and target language have similar chars to English Z,M,C, the chars can be also translated and will not be replaced back to {{A}} replacer for translation cache.

For example I will use Russian as target language but there same case for any target language where exist similar chars.

Example:

_substitutions.txt John=Джон

Then we have for example source English text appeared: John walking back.

Then for online service the line will be replaced with (source EN): ZMCZ walking back.

And online service can translate it as (target RU): ЗМЦЗ идет обратно,

Atleast it can happen in case with Deepl service but possible with any. In result I encountering wit cached translations like this:

Isabeau and Eustace interrupted their date...=ЗМЦЗ и Юстас прервать их свидание... Esther {{A}}=Эстер ЗМКЗ

The lines above is from autogenerated txt of real tests wit en->ru pair with latest XUA version.

I will refer to the pull request #322 because there is some comments about the replacers and variant of using <1> <2> <3>... <?> instead of ZM?Z.

Atamg1994 commented 2 months ago

I will refer to the pull request #322 because there is some comments about the replacers and variant of using <1> <2> <3>... <?> instead of ZM?Z.

actually <1> <2> <3>... <?> not exactly an ideal solution either since Google translator can insert spaces in different places of these keys example

<1> can become <1 > or < 1> or < 1 > after translation, and I mainly use queries to Google API; I don’t know what another translator will do with these keys
TokcDK commented 1 month ago

For digits can be added check and restoration of <# > or < #> or < # > to <#>. But strings cant be translated in 99% of cases when target language is not have any digits analog. Only see some issues with digits with Japanese target language because theoretically there is it can be changed to unicode analogs.

Maybe custom replacers option in settings for marks for online service then user can change them to any most suitable for specific service. But then need to rewrite function for the marks replacing back for cache.