My own localization system made from scratch!
Basically, it uses keys from .json
files to translate text, and that's all there is to it!
Initialization:
Localization.init({
languages: ['en-us', 'es-es', 'fr-fr', 'pt-br', 'yr-hr'],
directory: "languages", // this variable is optional
default_language: "en-us" // this variable is optional
});
Switching to another language:
Localization.switchLanguage("en-us");
Retrieving a key:
Localization.get("greeting", "en-us"); // If the second parameter is empty, defaults to current language
Basic .json
setup:
{
"greeting": "Hello world!",
"farewell": "Goodbye!"
}
For futher documentation, check out Localization.hx
.
You can check out this system in action in the samples/flixel
folder.
If you need localization tags, go here.