Open 3TUSK opened 1 year ago
I'm working on a mod that has a feature of automatic language detection on first game launch which is useful for modpack users. The -Duser.language=en
argument disables the way the mod gets user's system language with Locale.getLanguage()
. It would be nice to remove insertion of this argument or insert another argument containing the original language so I could use it as a workaround.
Role
I was testing localization for Fabric Loader.
Suggestion
Provide an option to make MultiMC not appending
-Duser.language=en
at the end of JVM argumentsBenefit
This would allow me testing translations for different languages in the way it should have been
This suggestion is unique
You may use the editor below to elaborate further.
https://github.com/MultiMC/Launcher/blob/7354c578fd5f80502cb1dbc48aa05f65d0bb1c31/launcher/minecraft/MinecraftInstance.cpp#L361
Right now, MultiMC always append a
-Duser.language=en
at the end of JVM arguments. The rationale behind this can traces back to as early as 2015:(Quoted from https://github.com/MultiMC/Launcher/issues/837#issuecomment-85596251.)
I just have encountered this niche need where I would like to have
-Duser.language=zh
in JVM arguments. As I said above, I was testing translations for Fabric Loader. To do this,!/net/fabricmc/loader/Messages.properties
, and it is loaded viaResourceBundle
. According to spec and convention, I put the translated file under the path!/net/fabricmc/loader/Messages_zh_CN.properties
, as I am doing a Simplified Chinese translation.!/META-INF/MANIFEST.MF
.ResourceBundle
to see that translated file.Problem is that, to make
ResourceBundle.getBundle
usesMessages_zh_CN.properties
instead of theMessages.properties
, I would have to change the default locale for the running JVM. There are two options for me:Locale.setDefault(...)
before Fabric Loader begins its work.-Duser.language=zh -Duser.country=CN
.Apparently option 2 is easier, and that is where the issue comes from: the behavior of having two
-Duser.language
is unpredictable.For now, my workaround is to name the translated file
Messages_en_CN.properties
and having just-Duser.country=CN
in JVM arguments. Doing so would trick JVM to favor the translation over the original. Still, having this weird combination sounds unnatural.I fully understand the niche nature of this request, so I really won't mind if this finally gets rejected. Even if this gets rejected, other people will perhaps not need to waste time on filling a ticket for this, making this a useful record.
Addendum 1: I forget to mention, such option should be default to opt-in, i.e. the
-Duser.language=en
should be appended by default.