Skip to main content

Localization

It is highly recommended that you use this feature as it also allows server admins to customize your strings.

Localization is a feature of MessageUtils.

Setup

To start working with it just call MessageUtils.setupTranslations(langResourcePath). For the most basic setup use null as parameter and you're done. Now server admins can add translations for your strings as they wish.

If you want to add your own translations to your mod fill langResourcePath with a string path pointing to a folder in your mod resources.

langResourcePath.PNG
For example BaseIO has MessageUtils.setupTranslations("com/unitedworldminers/BaseIO/lang").
It is recommended to call this method in your init method (FMLInitializationEvent).

Creating localization mappings

 The default language file is en_US.lang. This file will be used if you aren't providing the correct language.

You can use almost any string as a key, but it's recommended to abstract them.

The mapping files itself are the same as the ones from Minecraft: <key>=<mapping>, an example file can be found on the right sidebar.