View Single Post
02-23-16, 12:00 PM   #36
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
You create a set of default string variables
Code:
local Message1 = "Message 1"
local Message2 = "Message 2"

if GetLocale() == "deDE" then 
  Message1 = "Germane for Message 1"
  Message2 = "Germane for Message 2"
end
This is essentially the same as:
Code:
local Message1
local Message2

if GetLocale() == "deDE" then 
  Message1 = "German for Message 1"
  Message2 = "German for Message 2"
else
  Message1 = "Message 1"
  Message2 - "Message 2"
end
-- you know it's German because GetLocale returns "deDE" if the game is running on a german client so you take it on good faith and feedback that it will work . That or have VMs with the various language OSs installed .

So now:
xx:SetText(Message1) will display "German for Message 1" on a german client otherwise "Message 1".

These variables can be created simply like I did here or in a table like I did in my original and if your addon spans multiple .lua files would most likely be created in the addons private table
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 02-23-16 at 12:05 PM.
  Reply With Quote