Zedly / Zenchantments

More enchantments without mods or resource packs. CB/Spigot 1.14.4 / 1.12 / 1.11.x / 1.10.x
GNU General Public License v3.0
12 stars 23 forks source link

How plugin locales even work? #64

Closed justjamesbond closed 1 week ago

justjamesbond commented 1 week ago

I've noticed that the plugin's source resources include localization files for multiple languages. However, there doesn’t seem to be an obvious way to change the language in-game. I would like to know how to change/switch language of plugin?

Geolykt commented 1 week ago

The selected language depends on the locale of the JVM, as per https://github.com/Zedly/Zenchantments/blob/60bff12329e331f60af9d94c3ee40010d9bcc1d2/source/java/zedly/zenchantments/ZenchantmentsPlugin.java#L43

The language definitions themselves are hardcoded as per https://github.com/Zedly/Zenchantments/blob/60bff12329e331f60af9d94c3ee40010d9bcc1d2/source/java/zedly/zenchantments/I18n.java#L72 - that is, in order to change a string, the jar must be altered.

Note: It's been a very very long time since I worked with Zenchantments and my involvement predates the vast majority of the current codebase, so take my evaluation with a grain of salt.

justjamesbond commented 1 week ago

I need to recompile the plugin to I can change language?

Geolykt commented 1 week ago

You can change the language by changing the JVM startup flags - so something like -Duser.language=es to switch to Spanish. If you want to change the locale definitions themselves - then yeah, recompile it is.

justjamesbond commented 1 week ago

Alright, thank you