hypherionmc / simple-rpc-public

Simple-RPC Issues, wiki and data github
https://www.curseforge.com/minecraft/mc-mods/simple-discord-rpc/
14 stars 1 forks source link

[BUG] Translation is not working #47

Closed LolJohn11 closed 2 years ago

LolJohn11 commented 2 years ago

Describe the bug Despite making a translation file as per instructions in the tutorial, the mod is not changing the language of the Rich Presence when switching the Minecraft's game language. I tried different syntaxes for the translation file name since the tutorial has two different ones (simple-rpc_lang_code and simple-rpc-lang_code) but neither of them worked.

To Reproduce Steps to reproduce the behavior:

  1. Create a translation file as per the tutorial.
  2. Launch the game.
  3. Switch language from English to the target language
  4. Check Discord Rich Presence
  5. See the Rich Presence still pulling configuration from the English (default) config file

Expected behavior Discord Rich Presence content changes as specified in the translated file when you change the game language to the same language as specified by the language code in the translated file's name.

Versions:

hypherionmc commented 2 years ago

Hi. Thanks for the report

Without testing, looking at our code this does indeed appear to be a bug. In the 2.x versions, we would update the lang code set by the game with each rich presence update, so it would change "instantly".

Now it appears we only do it at startup, but there is a chance that by the time the mod loads, the lang code is not yet set by the game so it defaults back to english.

If you want to confirm this is what's happening, create a file called simple-rpc_en_us.toml and configure it according to the language you want to use. If I am correct about what's happening, it will load the en_us file instead of the default file.

We will fix the issue and release an update as well

LolJohn11 commented 2 years ago

Ok, I just tested it again, and turns out that the mod is working, I simply needed to first set the target language, then restart the game and the mod correctly picks up the translation with the "correct" file name, just as you described it.

The mod simply doesn't scan the current game language constantly (which is understandable from the code optimization standpoint), so it needs a game restart to apply this "setting".

I can't say if this behavior has to be changed, now that I know what is happening and thinking about how it may potentially negatively impact the mod's performance.

hypherionmc commented 2 years ago

Hmm thanks for the feedback. It shouldn't be an issue constantly monitoring it. We already have a monitor to detect edits to the configs to reload them without restarting the game, so we can just add an additional check to that to see if the language changed, and if it did, we reload the config

LolJohn11 commented 2 years ago

In that case, it would be great to see that change implemented in the next update! In the meantime, thanks for helping me learn how this process works.

hypherionmc commented 2 years ago

That's what we had before, it just got lost somewhere in the 3.x releases, but thanks for reporting. It's probably been broken for months but no one cares to report it

hypherionmc commented 2 years ago

Fixed this in development. Should be working fine on release, but will test it myself as well