View Single Post
02-25-24, 02:41 AM   #45
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,894
Originally Posted by Hubb777 View Post
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:
  1. addon.Texts = {
  2.     Rewards = {
  3.         enUS = "Possible Rewards",
  4.         deDE = "German for Possible Rewards",
  5.     },
  6.     Pets = {
  7.         enUS = "List of pets",
  8.         deDE = "German List of pets",
  9.     },
  10. }

You can then create FontStrings and set their texts using (set Rewards text):
Lua Code:
  1. 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.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-25-24 at 02:50 AM.
  Reply With Quote