Originally Posted by Hubb777
It looks like the problem with different languages has played a cruel joke again. Not the addon name, but my table name. For example, I will name the table “Possible rewards” or “List of pets”, I would like this inscription to also have a translation.
|
Create a table for your texts (1 sub-table for each with text you want on screen that contains the localised version of the title/whatever. eg.
Lua Code:
addon.Texts = {
Rewards = {
enUS = "Possible Rewards",
deDE = "German for Possible Rewards",
},
Pets = {
enUS = "List of pets",
deDE = "German List of pets",
},
}
You can then create FontStrings and set their texts using (set Rewards text):
Lua Code:
xxx:SetText(addon.Texts.Rewards[GetLocal()] or addon.Texts.Rewards.enUS) -- enUS being the default is the GetLocale() entry doesn't exist.
xxx being the variable used when creating the FontString.
You might want to see the wiki on
localisation if it gets more complicated.