Impelement localization
chancedj opened this issue ยท 4 comments
This should be pretty straight-forward. Adding a check-list in case you haven't worked with a localization system before!
- Add Libs/AceLocale (or the respective entry to the .pkgmeta file if PR #8 is merged simultaneously instead)
- Add library to TOC
- Initialise localization table before it is used (can be in Minimap.lua right now, or before all other files if they need to access it in the future)
- I'd also add Locales\enUS - deDE - frFR - ruRU - ... - etc. files, which can be loaded via Lua or XML
- Those should probably use the CF system as well to include the latest translations with every release - see API documentation here
- Prefix any phrase that needs to be localised appropriately, e.g., L["Hello"] whenever output is added if L is the localization table (which can be stored in the addon table)
Go, go, power rangers! ๐ (I hope I didn't forget anything)
It's a fairly minor addition. If you merge #8 in 1.2 you might as well add AceLocale to it like so:
Libs/AceLocale-3.0: url: https://repos.wowace.com/wow/ace3/trunk/AceLocale-3.0 tag: latest
(spaces are botched)
Setting a default locale (arg2 = true):
local L = LibStub("AceLocale-3.0"):NewLocale(addonName, "enUS", true)
Adding another locale:
`local L = LibStub("AceLocale-3.0"):NewLocale(addonName, "deDE")
L = L or {}
--@localization(locale="deDE", format="lua_additive_table", namespace="", same-key-is-true="true", handle-subnamespaces="none", handle-unlocalized="ignore")@
(exact syntax depends on the options, see CurseForge API documentation)
Getting the localisation table:
L = LibStub("AceLocale-3.0"):GetLocale(addonName, false)
I can submit a PR once the other one is added to the master branch, I guess, but since you self-assigned this I figured you'd be having at it - and that's fine with me. It's rather straight-forward to add localization, thankfully, although keeping it up-to-date can be a hassle.
Thanks. i'll work on getting this in either the next release (1.2) or 1.3. I have it slated currently for 1.2 but depending on how much work is involved with what i'm doing next, i may push it till then. it's a pretty small base right now of users but as it grows i know the localization will definitely help.