
Interface terminal localization is different with client language.
Forever-178 opened this issue · 4 comments
Describe the bug
Interface terminal and Interface configuration terminal localization is different with client language.
Because the only supported locale is en_us on a dedicated server, I think it should be decide by client.
https://docs.minecraftforge.net/en/latest/concepts/internationalization/#internationalization-and-localization
To Reproduce
Play game on a forge server and client language is not en_us. (In this case locale is zh_cn. )
Expected behavior
Interface name are displayed as client language.
Additional context
Environment
- Minecraft Version: 1.12.2
- AE2 Version: 0.56.6
这个问题目前有两个解决思路
- 使用反射来判断getUnlocalizedNameIneffciently是否被重写,如果被重写则调用该方法,否则调用getTranslationKey
- 使用getTranslationKey,向MMCE提交issue请求修复getTranslationKey
There are 2 way to fix it.
- Use reflection to check if getUnlocalizedNameInefficiently has been overridden. If it has been overridden, call that method; otherwise, call getTranslationKey.
- Use getTranslationKey to submit an issue request to MMCE to fix getTranslationKey.
这个貌似是没法修的。因为获取名字的函数是带不了语言代码的
我在尝试跟踪这个bug,是由于服务端没有正确获取方块的TranslationKey导致的,可以参考这个分支Forever-178@f8c1ccb
在修改了服务端的逻辑后,客户端针对分子装配室的查找的逻辑也要一并修改。
目前遇到的问题是,获取TranslationKey(也就是UnlocalizedName)有两个不同的方法,getTranslationKey和getUnlocalizedNameInefficiently
部分mod重写了这两个方法中的一个,另外一个无法获得正确的结果。
例如
- 模块化机械社区版
重写了getUnlocalizedNameInefficiently, 在已经成型的多方块结构中,针对小型输入仓,使用getTranslationKey获得的是tile.modularmachinery.blockinputbus
,getUnlocalizedNameInefficiently获得的是正确的结果tile.modularmachinery.blockinputbus.small
- CoFH
重写的是getTranslationKey,获得的结果是以.name
结尾的,因此getUnlocalizedNameInefficiently会意外获得本地化后的结果。
This part is translation for chinese above
I'm trying to track this bug. It is caused by server gets wrong TranslationKey. I'm try to fix it on this branch. Forever-178@f8c1ccb
When change the logic at server, client should change the logic to search molecular assembler.
Now there is a problem. To get translationKey (same with UnlocalizedName) , we have two different methods, getTranslationKey and getUnlocalizedNameInefficiently. Some mods overrides one method, another one can not get right result.
For example:
- ModularMachinery-Community-Edition
overrides getUnlocalizedNameInefficiently. In a formed machine, to small item input, getTranslationKey returnstile.modularmachinery.blockinputbus
, getUnlocalizedNameInefficiently returns right resulttile.modularmachinery.blockinputbus.small
- CoFH
overrides getTranslationKey which returns value ended with.name
. So getUnlocalizedNameInefficiently will return localized name.
@Forever-178 那你自己修这个吧,我就不费这个劲了。我建议是使用getTranslationKey 这个是标准函数