-- @return Locale Table to add localizations to, or nil if the current locale is not required. |
function AceLocale:NewLocale(application, locale, isDefault, silent) |
|
if silent and not isDefault then |
error("Usage: NewLocale(application, locale[, isDefault[, silent]]): 'silent' can only be specified for the default locale", 2) |
end |
|
-- GAME_LOCALE allows translators to test translations of addons without having that wow client installed |
-- Ammo: I still think this is a bad idea, for instance an addon that checks for some ingame string will fail, just because some other addon |
-- gives the user the illusion that they can run in a different locale? Ditch this whole thing or allow a setting per 'application'. I'm of the |
-- opinion to remove this. |
local gameLocale = GAME_LOCALE or gameLocale |
|
if locale ~= gameLocale and not isDefault then |
return -- nop, we don't need these translations |
local app = AceLocale.apps[application] |
|
if silent and app then |
geterrorhandler()("Usage: NewLocale(application, locale[, isDefault[, silent]]): 'silent' must be specified for the first locale registered") |
end |
|
local app = AceLocale.apps[application] |
|
if not app then |
app = setmetatable({}, silent and readmetasilent or readmeta) |
if silent=="raw" then |
app = {} |
else |
app = setmetatable({}, silent and readmetasilent or readmeta) |
end |
AceLocale.apps[application] = app |
AceLocale.appnames[app] = application |
end |
|
|
if locale ~= gameLocale and not isDefault then |
return -- nop, we don't need these translations |
end |
|
registering = app -- remember globally for writeproxy and writedefaultproxy |
|
if isDefault then |