Navigation menu

WoW:Parsing event messages: Difference between revisions

Jump to navigation Jump to search
m (Wikify)
Line 22: Line 22:
  end
  end


== What's so dirty about the quick-and-dirty way? ==
You will find that as people in other locales start using your AddOn, that they have problems.  This is due to the fact that your code is expecting the system messages to be arriving in English, whereas they might actually be arriving in some other language.
Once you've started off on the quick-and-dirty way, you are likely to consider asking people to provide you translations, so you can modify your code accordingly for a quick-and-dirty fix.  However, you can tell what a mess your code would quickly turn into:
  function MyHonorTracker_OnEvent()
  function MyHonorTracker_OnEvent()
   if(event == "CHAT_MSG_COMBAT_HONOR_GAIN") then
   if(event == "CHAT_MSG_COMBAT_HONOR_GAIN") then
Line 35: Line 30:
     elseif(GetLocale() == "frFR") then
     elseif(GetLocale() == "frFR") then
       pattern = "french-words (.+) french-words (.+) french-words (.+)";
       pattern = "french-words (.+) french-words (.+) french-words (.+)";
       -- notice that the parameters are not necessarily always in the same order in all languages
    elseif(GetLocale() == "koKR") then
       pattern = "(.+) korean-for-dies, korean-words: (.+) %(more-korean: (.+)%)";
     else
     else
       pattern = "who knows";
       pattern = "who knows";
Anonymous user