I18N Guide
Introduction
LeviLamina provides a simple i18n class to support multilingual functionality for itself and mods.
Usage
Loading Language Files
- Include the header file
ll/api/i18n/I18n.h
. - Call the
ll::i18n::getInstance().load
method in theload
method of your mod, passing the path to the language files. This path is typically a folder but can also be a single JSON file. LeviLamina provides theMod::getLangDir
method for developers to obtain the standard language file path.
C++ | |
---|---|
1 2 3 4 5 6 7 8 9 |
|
Example language file path:
- lang/
- de.json
- en.json
- fr.json
- id.json
- it.json
- ja.json
- ko.json
- pt_BR.json
- ru.json
- th.json
- tr.json
- vi.json
- zh_CN.json
- zh_TW.json
Example language file content:
JSON | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 |
|
Using I18N to Translate Text
- Include the header file
ll/api/i18n/I18n.h
. - Use the directive
using namespace ll::i18n_literals
in your source file. - Append the
_tr()
literal to strings for translation.
C++ | |
---|---|
1 2 3 4 5 6 7 8 9 |
|