I’m a first-time Addon author and and also new to lua. So here goes.
I would like to provide localization for my addon (it’s nothing special, just a learning toy) and have some questions:
First question: how to configure my addon’s files for localization. I’ve chosen to localize the addon’s strings in a file name EnUS_Locale.lua. Here’s what its header looks like.
local Addon, locales = ...
local L = setmetatable({}, { __index = function(t, k)
local v = tostring(k)
rawset(t, k, v)
return v
end })
locales.L = L
local LOCALE = GetLocale()
if LOCALE == "enUS" then
L["ADDON_NAME"] = Addon
end
Then, in a subsequent file, Test.lua, I have this:
local Addon, test = ...
local L = locales.L
But when I load these two files, I get the error message below (Test.lua is loaded after EnUS_Locale.lua).
Message: ... attempt to index global 'locales' (a nil value)
What am I missing?
Second question: I’ve noticed quite a few addons use ACE_Locale. On the other hand not a few addons do not use ACE and instead roll their own. What would you recommend?
thanks,