Thread Tools Display Modes
04-17-15, 07:58 PM   #1
Recompense
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 15
Changing Client Locale

Hi there - been a while since I've written addon code requiring localization, but it looks like one of my recent addons has gained at least 1 international user! I cheated/used liberal shortcuts while coding and was using English string values, which broke the addon for this user.


Coding out the comparisons to English is simple, but while I'm at it I figured I should create the basics of localization for the addon.


Is there any way to change the client locale? My past research years ago suggested it was doable (although tricky) but I don't know what, if anything, is still possible with the Battle.net launcher and other changes to the game.
  Reply With Quote
04-17-15, 09:13 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
You shouldn't need to change your client's locale to make your addon locale independent or localized.

What is it that breaks on the user's install?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
04-17-15, 09:20 PM   #3
Recompense
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 15
You're right. I don't need to. It was to test the localization, not to code it.

My code checks for a return of a function and compares it to an English string, so it breaks when their client doesn't return the same English string. The fix is to have it compare against the expected return of a Garrison function. That party's easy to fix, but I'd prefer to localize the UI as well. Being able to change locales means I could check for instances where some elements are sized wrong due to the translations being longer than English.
  Reply With Quote
04-17-15, 09:25 PM   #4
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Just lie to whatever function you're using to get the locale. For example, instead of:

Code:
local locale = GetLocale()

if locale == "deDE" then
    DoStuff()
end
Do this instead:

Code:
local locale = "deDE" -- GetLocale()
EDIT: Though, this won't work if you're using strings from GlobalStrings.lua and the like. In practice, though, I've only had a handful of users that this impacted, and it was easily fixed by looking at their reported screenshots.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.

Last edited by Torhal : 04-17-15 at 09:27 PM.
  Reply With Quote
04-18-15, 02:44 PM   #5
Recompense
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 15
Originally Posted by Torhal View Post
Just lie to whatever function you're using to get the locale. For example, instead of:
True, this will work great for whatever UI elements I'm testing.


There are a few instances where I need localized zone text, though. I could look these things up on Wowhead or other sites, but I thought there might be a way to change the client locale and take care of everything in one client session.


Thanks for the suggestions!
  Reply With Quote
04-18-15, 04:35 PM   #6
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
You can change language of the client from the settings (cog icon) on the battle.net launcher.

It will download resources for the first time you do that for each language but if you have the disk space (and bandwidth) to spare it's as easy as 2 clicks after that.
  Reply With Quote
04-18-15, 04:37 PM   #7
Recompense
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 15
Originally Posted by Dridzt View Post
You can change language of the client from the settings (cog icon) on the battle.net launcher.

It will download resources for the first time you do that for each language but if you have the disk space (and bandwidth) to spare it's as easy as 2 clicks after that.
I did find that setting but I didn't think it impacted the game language - but I'll have to check it out!
  Reply With Quote
04-18-15, 05:14 PM   #8
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
Originally Posted by Recompense View Post
True, this will work great for whatever UI elements I'm testing.


There are a few instances where I need localized zone text, though. I could look these things up on Wowhead or other sites, but I thought there might be a way to change the client locale and take care of everything in one client session.


Thanks for the suggestions!
You can get all the zone names localized at runtime. My Grail addon has been doing this for years (even though when I first implemented it I had a list of zone names within the addon that I had to localize). Basically use GetMapContinents(), GetMapZones(), GetMapSubzones(), etc. There are some changes made in the returned values with Draenor, so I am not sure whether the online assets have the latest information concerning those changes. If they don't you can always look at Grail for those APIs I mentioned to see what it does.
  Reply With Quote
04-18-15, 05:14 PM   #9
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
Originally Posted by Dridzt View Post
You can change language of the client from the settings (cog icon) on the battle.net launcher.

It will download resources for the first time you do that for each language but if you have the disk space (and bandwidth) to spare it's as easy as 2 clicks after that.
This seems to only work for Starcraft for me and not WoW.
  Reply With Quote
04-18-15, 06:11 PM   #10
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Yeah I lied sorry, haven't played in months.
I was remembering the old launcher.

Currently the option to change WoW client locale is at
Game Menu > System > Languages from the character selection screen or in-game.

Last edited by Dridzt : 04-18-15 at 06:14 PM.
  Reply With Quote
04-19-15, 05:09 PM   #11
Recompense
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 15
Originally Posted by Dridzt View Post
Yeah I lied sorry, haven't played in months.
I was remembering the old launcher.

Currently the option to change WoW client locale is at
Game Menu > System > Languages from the character selection screen or in-game.
This I like! I'll check it out.
  Reply With Quote
04-20-15, 02:13 PM   #12
Nimhfree
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 267
Originally Posted by Recompense View Post
This I like! I'll check it out.
If you are like me, and the WoW interface limits you to the selection of languages "normally" available in your region, you will not get options for all of them within game. When I attempt to test localizations I usually use the PTR and I manually edit the Config.wtf file in the WTF directory to change the entries for textLocale and audioLocale to languages I want to test (when WoW is not running). So, German would be "deDE", Latin American Spanish "esMX", etc.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Changing Client Locale

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off