Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interface terminal localization is different with client language. #521

Open
Forever-178 opened this issue Dec 17, 2024 · 4 comments · May be fixed by #522
Open

Interface terminal localization is different with client language. #521

Forever-178 opened this issue Dec 17, 2024 · 4 comments · May be fixed by #522

Comments

@Forever-178
Copy link

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

Interface
2024-12-17_15 52 18

Environment

  • Minecraft Version: 1.12.2
  • AE2 Version: 0.56.6
@zeng-github01
Copy link

zeng-github01 commented Dec 18, 2024

这个貌似是没法修的。因为获取名字的函数是带不了语言代码的

@Forever-178
Copy link
Author

这个貌似是没法修的。因为获取名字的函数是带不了语言代码的

我在尝试跟踪这个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 returns tile.modularmachinery.blockinputbus, getUnlocalizedNameInefficiently returns right result tile.modularmachinery.blockinputbus.small
  • CoFH
    overrides getTranslationKey which returns value ended with .name. So getUnlocalizedNameInefficiently will return localized name.

@Forever-178
Copy link
Author

这个问题目前有两个解决思路

  1. 使用反射来判断getUnlocalizedNameIneffciently是否被重写,如果被重写则调用该方法,否则调用getTranslationKey
  2. 使用getTranslationKey,向MMCE提交issue请求修复getTranslationKey

There are 2 way to fix it.

  1. Use reflection to check if getUnlocalizedNameInefficiently has been overridden. If it has been overridden, call that method; otherwise, call getTranslationKey.
  2. Use getTranslationKey to submit an issue request to MMCE to fix getTranslationKey.

@zeng-github01
Copy link

@Forever-178 那你自己修这个吧,我就不费这个劲了。我建议是使用getTranslationKey 这个是标准函数

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants