How to add localization support
From ESOUI Wiki
This is a collection of info for adding localization (multilingual) support to your addon.
There are several ways to do this, and this is just one method (that ZOS uses for its translations)
Separate each language to its own Lua file, preferably in a directory.
Then add the following to your addon manifest to load the strings:
This loads the English text as default, and then loads the other language if it's present. Note: it's important to have a default in light of the Spanish and Russian fan translation projects.
Translation works best if all the strings are separate from the actual display.
You can create strings in the standards ZOS localization with this function:
The string ID must be unique. Prefix this with YOUR_ADDON_NAME_ to make sure it's unique -> YOUR_ADDON_NAME_GLOBALLY_UNIQUE_STRING_ID
You shouldn't use SI_ as the beginning of the unique indeitifer as this is ZOs namespace!
This function works by creating the string in a lookup table and then creates a global variable that has a number to identify which string it is.
If you add the same unique identifier YOUR_ADDON_NAME_GLOBALLY_UNIQUE_STRING_ID via the function
to the internal version table of the strings,
you are able to properly use them with another language as well.
In the other language file you can create just a new version, higher or same, and add the translated text via the function
SafeAddString(YOUR_ADDON_NAME_GLOBALLY_UNIQUE_STRING_ID, "Your translation for the other language", 2)
where the last parameter (here: 2) is the new version.
Strings that you created with the string ID method can then be easily accessed throughout your addon.
The above example would be accessed with:
GetString( YOUR_ADDON_NAME_GLOBALLY_UNIQUE_STRING_ID )
Using string format functions
zo_formatstr lets you do advanced substitution in translations (see How to format strings with zo strformat).
Relevant forum threads:
If you can't translate yourself, ask in this forum:
This is all volunteer (just like addon programming), but it doesn't hurt to ask.
Rather than download a completely different client language, you can dynamically change the language ingame.
/script SetCVar("language.2", "de")
Replace "de" with the character code for the appropriate language you're testing, e.g. en, fr, ru, jp, ...