View Single Post
02-23-16, 03:09 PM   #37
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Originally Posted by tyroneexe View Post
are we talking
Lua Code:
  1. {
  2.                 Icon="Interface\\Icons\\Ability_rogue_sprint";
  3.                 Tooltip="Amphitheater of Annihilation(AoA)";
  4.                 Message={
  5.                     "Amphitheater of Annihilation(AoA) - EVENT:STADIUM RACING - Block the entrance!","INSTANCE_CHAT";
  6.                     "AoA AoA GO NOW! - Block the entrance!","RAID_WARNING";}
  7.                
  8. if GetLocale() == "deDE" then
  9.                 Message={
  10.                        "CHATMESSAGE_DE ","INSTANCE_CHAT";
  11.                     "RAIDMESSAGE_DE ","RAID_WARNING";};
  12.                 Emote="FOLLOW";
  13.             };

and how do you test without a deDE client. Well at least I know some Germans
Close, but not quite. You can't put an IF block in the middle of a table constructor. What most people do to handle localization is make a completely separate table that stores localized strings. Since localization can take up a lot of code, it's common to place it in a separate Lua file.

For this specifically, I'd put the entire layout table in an IF block and make copies of localized versions for each locale check.
Lua Code:
  1. local ButtonData;-- Data prototype
  2. if GetLocale()=="deDE" then
  3.     ButtonData={
  4. --      deDE Layout
  5.     };
  6. elseif GetLocale()=="frFR" then
  7.     ButtonData={
  8. --      frFR Layout
  9.     };
  10. else--  Default enUS
  11.     ButtonData={
  12. --      enUS Layout
  13.     };
  14. end

To force it to load a specific locale, you could temporarily modify the condition statement you want to load to evaluate to true. Adding or true to it should do the trick.



PS: I forgot I had the "Show only in Ashran" code disabled for testing. This has been fixed in my previous post.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 02-23-16 at 03:12 PM.
  Reply With Quote