m
Move page script moved page Localizing an addon to WoW:Localizing an addon without leaving a redirect
m (I hate having to scroll sideways, and I'm on a 1366 width screen.) |
m (Move page script moved page Localizing an addon to WoW:Localizing an addon without leaving a redirect) |
||
| (4 intermediate revisions by 4 users not shown) | |||
| Line 1: | Line 1: | ||
{{ | {{wow/uihowto}} | ||
Blizzard releases many localized versions of the World of Warcraft client, each version translating the game to a particular language. Players in some regions may also install additional [http://www.wow-europe.com/en/downloads/elp/ language packs], allowing them to play World of Warcraft in a desired language. | Blizzard releases many localized versions of the World of Warcraft client, each version translating the game to a particular language. Players in some regions may also install additional [http://www.wow-europe.com/en/downloads/elp/ language packs], allowing them to play World of Warcraft in a desired language. | ||
| Line 38: | Line 38: | ||
=== Localization in the .toc file === | === Localization in the .toc file === | ||
A number of [[TOC format#Official tags|official .toc tags]] support localization by appending a locale suffix to a tag name. This mechanism allows addons to present a localized name and description of the addon in the addons interface. The following example illustrates this, by adding a french ("frFR" locale) title and description to the Gatherer addon: | #A number of [[TOC format#Official tags|official .toc tags]] support localization by appending a locale suffix to a tag name. This mechanism allows addons to present a localized name and description of the addon in the addons interface. The following example illustrates this, by adding a french ("frFR" locale) title and description to the Gatherer addon: | ||
Title: Gatherer | Title: Gatherer | ||
Title-frFR: Gatherer (en Francais, in French) | Title-frFR: Gatherer (en Francais, in French) | ||
Notes: Gatherer, displays stuff you gather in your minimap | Notes: Gatherer, displays stuff you gather in your minimap | ||
Notes-frFR: Gatherer, affiche les objets | Notes-frFR: Gatherer, affiche les objets recoltés dans la minicarte | ||
=== Making an addon localizable === | === Making an addon localizable === | ||
To begin with, you need to ensure that every time your addon displays a piece of text to the user, that piece of text ''can'' be localized. Consider the two pieces of code below: | To begin with, you need to ensure that every time your addon displays a piece of text to the user, that piece of text ''can'' be localized. Consider the two pieces of code below: | ||
{| | {| class="darktable" | ||
| valign="top"| | |- valign="top" style="font-family:monospace;" | ||
| | || fontString:SetText("Hello World!") | ||
fontString:SetText(L["Hello World!"]); | | width="40px" | | ||
|| local L = MyLocalizationTable;<br>fontString:SetText(L["Hello World!"]); | |||
|} | |} | ||
Code on the left could not be localized without editing the file containing it; while the code in the right wraps the output in a table lookup -- so if the value associated with the "Hello World!" key in MyLocalizationTable was altered, the text output would change. We can use a metatable to allow you to write localizable code without worrying about supplying a default localization: | Code on the left could not be localized without editing the file containing it; while the code in the right wraps the output in a table lookup -- so if the value associated with the "Hello World!" key in MyLocalizationTable was altered, the text output would change. We can use a metatable to allow you to write localizable code without worrying about supplying a default localization: | ||
| Line 145: | Line 146: | ||
* A complete [http://forums.wowace.com/showthread.php?t=15610 thread] where to download and upload updated v3.0.1+ WotLK GlobalStrings for all ten languages actually recognized (enUS enGB esES esMX deDE frFR ruRU zhCN koKR zhTW) | * A complete [http://forums.wowace.com/showthread.php?t=15610 thread] where to download and upload updated v3.0.1+ WotLK GlobalStrings for all ten languages actually recognized (enUS enGB esES esMX deDE frFR ruRU zhCN koKR zhTW) | ||
* A github [http://github.com/tekkub/wow-globalstrings/tree/master repository] for storing community provided GlobalStrings.lua | * A github [http://github.com/tekkub/wow-globalstrings/tree/master repository] for storing community provided GlobalStrings.lua | ||