Added support for non-true values in the base locale
This commit is contained in:
+12
-2
@@ -88,6 +88,7 @@ end
|
||||
|
||||
local localizedStrings = {}
|
||||
|
||||
table.insert(locale, baseLocale)
|
||||
-- load existing data from locale files
|
||||
for idx, lang in ipairs(locale) do
|
||||
local file = io.open(lang .. ".lua", "r")
|
||||
@@ -98,6 +99,7 @@ for idx, lang in ipairs(locale) do
|
||||
localizedStrings[lang] = L
|
||||
file:close()
|
||||
end
|
||||
table.remove(locale)
|
||||
|
||||
-- Write enUS file
|
||||
local file = io.open(string.format("%s.lua", baseLocale), "w")
|
||||
@@ -106,7 +108,11 @@ file:write("-- Generated by Babelfish script, do not edit directly.\n")
|
||||
file:write(string.format("local L = LibStub(\"AceLocale-3.0\"):NewLocale(\"%s\", \"%s\", true)\n", localeName, baseLocale))
|
||||
file:write("\n\n")
|
||||
for idx, match in ipairs(work) do
|
||||
file:write(string.format("L[\"%s\"] = true\n", match))
|
||||
local value = "true"
|
||||
if type(localizedStrings[baseLocale][match]) == "string" then
|
||||
value = string.format("\"%s\"", localizedStrings[baseLocale][match])
|
||||
end
|
||||
file:write(string.format("L[\"%s\"] = %s\n", match, value))
|
||||
end
|
||||
file:close()
|
||||
|
||||
@@ -123,7 +129,11 @@ for idx, lang in ipairs(locale) do
|
||||
if L[match] then
|
||||
file:write(string.format("L[\"%s\"] = \"%s\"\n", match, L[match]))
|
||||
else
|
||||
file:write(string.format("-- L[\"%s\"] = true\n", match))
|
||||
local value = "true"
|
||||
if type(localizedStrings[baseLocale][match]) == "string" then
|
||||
value = string.format("\"%s\"", localizedStrings[baseLocale][match])
|
||||
end
|
||||
file:write(string.format("-- L[\"%s\"] = %s\n", match, value))
|
||||
end
|
||||
end
|
||||
file:close()
|
||||
|
||||
Reference in New Issue
Block a user