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