bbepis / XUnity.AutoTranslator

MIT License
1.85k stars 285 forks source link

All translation results are gibberish‘口口口' #560

Open HuxiaoRoar opened 1 month ago

HuxiaoRoar commented 1 month ago

Frist,I just wanted to say thanks for making this cool plugin. It's awesome how it helps us talk to each other without the language getting in the way。I'm not the best with English, so I'm relying on AI to help me translate. I hope everyone understands what I'm trying to say. GAME:Orwell Ignorance is Strength Synthesis RIP unity 5.6.0f3 image I tried using the TMP font file ,I also tried to export a TMP file (han1) that is confirmed to support Chinese fonts specifically for the game.Since version 5.63 doesn't have TextMeshPro, I made it with the latest version, hoping it would be backward compatible. image "I also turned off UI scaling, but it was to no avail; everything is still garbled. So, I'm beginning to suspect that the problem might not be related to the font itself. The game's text can be captured and translated normally, but the translated content isn't being properly mounted. I will share my settings and the plugin's error messages below. [Service] Endpoint=PapagoTranslate FallbackEndpoint=DeepLTranslate

[General] Language=zh FromLanguage=en

[Files] Directory=Translation{Lang}\Text OutputFile=Translation{Lang}\Text_AutoGeneratedTranslations.txt SubstitutionFile=Translation{Lang}\Text_Substitutions.txt PreprocessorsFile=Translation{Lang}\Text_Preprocessors.txt PostprocessorsFile=Translation{Lang}\Text_Postprocessors.txt

[TextFrameworks] EnableIMGUI=False EnableUGUI=True EnableNGUI=True EnableTextMeshPro=True EnableTextMesh=False EnableFairyGUI=True

[Behaviour] MaxCharactersPerTranslation=2500 IgnoreWhitespaceInDialogue=True MinDialogueChars=20 ForceSplitTextAfterCharacters=0 CopyToClipboard=False MaxClipboardCopyCharacters=2500 ClipboardDebounceTime=1.25 EnableUIResizing=False EnableBatching=True UseStaticTranslations=True OverrideFont=Microsoft JhengHei OverrideFontSize= OverrideFontTextMeshPro= FallbackFontTextMeshPro= ResizeUILineSpacingScale= ForceUIResizing=False IgnoreTextStartingWith=\u180e; TextGetterCompatibilityMode=False GameLogTextPaths= RomajiPostProcessing=ReplaceMacronWithCircumflex;RemoveApostrophes;ReplaceHtmlEntities TranslationPostProcessing=ReplaceMacronWithCircumflex;ReplaceHtmlEntities RegexPostProcessing= CacheRegexPatternResults=False PersistRichTextMode=Final CacheRegexLookups=False CacheWhitespaceDifferences=False GenerateStaticSubstitutionTranslations=False GeneratePartialTranslations=False EnableTranslationScoping=True EnableSilentMode=True BlacklistedIMGUIPlugins= EnableTextPathLogging=False OutputUntranslatableText=False IgnoreVirtualTextSetterCallingRules=False MaxTextParserRecursion=1 HtmlEntityPreprocessing=True HandleRichText=True EnableTranslationHelper=False ForceMonoModHooks=False InitializeHarmonyDetourBridge=False RedirectedResourceDetectionStrategy=AppendMongolianVowelSeparatorAndRemoveAll OutputTooLongText=False TemplateAllNumberAway=False ReloadTranslationsOnFileChange=False DisableTextMeshProScrollInEffects=False CacheParsedTranslations=False

[Texture] TextureDirectory=Translation{Lang}\Texture EnableTextureTranslation=False EnableTextureDumping=False EnableTextureToggling=False EnableTextureScanOnSceneLoad=False EnableSpriteRendererHooking=False LoadUnmodifiedTextures=False DetectDuplicateTextureNames=False DuplicateTextureNames= EnableLegacyTextureLoading=False TextureHashGenerationStrategy=FromImageName CacheTexturesInMemory=True EnableSpriteHooking=False

[ResourceRedirector] PreferredStoragePath=Translation{Lang}\RedirectedResources EnableTextAssetRedirector=False LogAllLoadedResources=False EnableDumping=False CacheMetadataForAllFiles=True

[Http] UserAgent= DisableCertificateValidation=True

[TranslationAggregator] Width=686 Height=267 EnabledTranslators=

[Debug] EnableConsole=False

[Migrations] Enable=True Tag=5.3.1

[Baidu] BaiduAppId= BaiduAppSecret= DelaySeconds=1

[BingLegitimate] OcpApimSubscriptionKey=

[Custom] Url=

[DeepL] ExecutableLocation= MinDelaySeconds=2 MaxDelaySeconds=6

[DeepLLegitimate] ExecutableLocation= ApiKey= Free=False

[ezTrans] InstallationPath=

[Google] ServiceUrl=

[GoogleV2] ServiceUrl= RPCID=MkEWBc VERSION=boq_translate-webserver_20210323.10_p0 UseSimplest=False

[GoogleLegitimate] GoogleAPIKey=

[LecPowerTranslator15] InstallationPath=

[LingoCloud] LingoCloudToken=

[Watson] Url= Key=

[Yandex] YandexAPIKey=

[Warning: HarmonyX] AccessTools.Method: Could not find method for type TMPro.TMP_Text and name SetCharArray and parameters (char[], int, int) [Warning:XUnity.AutoTranslator] Could not hook 'TMP_Text_SetCharArray_Hook2'. Likely due differences between different versions of the engine or text framework. [Info :XUnity.AutoTranslator] Loaded XUnity.AutoTranslator into Unity [5.6.3f1] game. [Info : BepInEx] Loading [XUnity Resource Redirector 2.1.0] [Message: BepInEx] Chainloader startup complete

No matter what kind of help I receive, I will be very grateful.

getoutnow2013 commented 4 weeks ago

基本上會出現□□□,就是代表遊戲用的TMP字型裡面缺字 所以一般是用自訂的 TMP 來覆蓋上去 這邊提供的就是 arialuni_sdf_u2018 / arialuni_sdf_u2019 的辦法

使用 arialuni_sdf_u2018 / arialuni_sdf_u2019 的方式是:

  1. 遊戲根目錄要放 arialuni_sdf_u2019 --> 你有做
  2. AutoTranslatorConfig.ini 設定中 FallbackFontTextMeshPro=arialuni_sdf_u2019 --> 你沒做

所以你可以試著修改設定看看,如果2019不行,再去試試2018

當然,這個解法也不是絕對的 像我另外一款遊戲也是無法解決,因為那款遊戲用的TMP版本是1.4.0 而 arialuni_sdf_u2019 的 TMP 版本是 1.1.0 當遊戲的TMP版本和字型的TMP版本不一樣時,一樣無法使用 只能說去他的 Unity

HuxiaoRoar commented 4 weeks ago

基本上會出現□□□,就是代表遊戲用的TMP字型裡面缺字 所以一般是用自訂的 TMP 來覆蓋上去 這邊提供的就是 arialuni_sdf_u2018 / arialuni_sdf_u2019 的辦法

使用 arialuni_sdf_u2018 / arialuni_sdf_u2019 的方式是:

  1. 遊戲根目錄要放 arialuni_sdf_u2019 --> 你有做
  2. AutoTranslatorConfig.ini 設定中 FallbackFontTextMeshPro=arialuni_sdf_u2019 --> 你沒做

所以你可以試著修改設定看看,如果2019不行,再去試試2018

當然,這個解法也不是絕對的 像我另外一款遊戲也是無法解決,因為那款遊戲用的TMP版本是1.4.0 而 arialuni_sdf_u2019 的 TMP 版本是 1.1.0 當遊戲的TMP版本和字型的TMP版本不一樣時,一樣無法使用 只能說去他的 Unity

是的,是的,你说的对,感谢帮助。 我知道是这样的原理,不光他这边提供的这两个,我还特意去换了几个,以排查是不是版本的问题。 但是问题就在这里了,就像你说的,它可能需要一个版本一一对应。这又涉及到一个新的问题,如果自己去创建TMP文件的话,需要精准地找到他当时用的版本。这个插件在早些年间并不是unity的官方的一部分,是以第三方售卖插件的形式在它的官网上贩卖,但是后来这个插件被收编了,导致这个插件在官网上,反而没有贩卖下载的途径,而这个插件他们的官方论坛所提供的下载本地安装版本,所有的链接都失效了,现在就只能从民间去找到一些部分的老版本本地安装。 我这个游戏它采用的unity很老,没有办法去本地安装那个可以单独导出TMP文件的插件,或许这一步可以有一些办法解决,可能还有一些别的老的插件,也可以让我们这样单独的导出TMP文件。 现在我的解决方案是把游戏在保存一份,对我这个临时的游戏进行解包,把它包含中文的字体文件抠出来,就是一个图片和一个解释说明的文件,再把这些内容稍作修改在塞回需要翻译的游戏里。 而且这样子可能还有一个好的地方,就是如果用插件去覆盖,那这个只能用一种字体了,你绝对想不到我这个游戏它采用了多少个字体。他光字体家族就有大概6,7种,然后每个家族他又分别采用不同的粗细。保守估计至少在10种以上的字体,所以我想既然都走到这一步了,不如就干脆把这个游戏里的每种字体,都换成支持中文的字体。 image 现在已经有了很不错的进展。接下来就是一一校对翻译内容了,这个插件确实很厉害,也感谢你的耐心回复。

HuxiaoRoar commented 4 weeks ago

基本上會出現□□□,就是代表遊戲用的TMP字型裡面缺字 所以一般是用自訂的 TMP 來覆蓋上去 這邊提供的就是 arialuni_sdf_u2018 / arialuni_sdf_u2019 的辦法

使用 arialuni_sdf_u2018 / arialuni_sdf_u2019 的方式是:

  1. 遊戲根目錄要放 arialuni_sdf_u2019 --> 你有做
  2. AutoTranslatorConfig.ini 設定中 FallbackFontTextMeshPro=arialuni_sdf_u2019 --> 你沒做

所以你可以試著修改設定看看,如果2019不行,再去試試2018

當然,這個解法也不是絕對的 像我另外一款遊戲也是無法解決,因為那款遊戲用的TMP版本是1.4.0 而 arialuni_sdf_u2019 的 TMP 版本是 1.1.0 當遊戲的TMP版本和字型的TMP版本不一樣時,一樣無法使用 只能說去他的 Unity

我才看见你耐心的指出了我没做的那一步。我其实做了,只不过这复制过来的这个没有写,上上下下的好几个我都写了。OverrideFont=Microsoft JhengHei OverrideFontTextMeshPro= FallbackFontTextMeshPro= 还试了试本地的字体都不行,所以当时才感到疑惑。 不过如果你说这个是1.1.0生成的,那就解释的通了,别的途径提供的也只会越来越新,这游戏应该是1.0.6左右的版本。