Some more tweaks to Babelfish script, changing output format slightly, and re-run the script.

This commit is contained in:
Hendrik Leppkes
2008-09-29 11:23:31 +02:00
parent ca8e48aeec
commit fa56f2787c
10 changed files with 25 additions and 24 deletions
+15 -23
View File
@@ -99,41 +99,33 @@ 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")
assert(file, "Could not open enUS.lua for writing")
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
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()
-- Write locale files
for idx, lang in ipairs(locale) do
local file = io.open(lang .. ".lua", "w")
assert(file, "Could not open ".. lang .. ".lua for writing")
file:write("-- Please make sure to save the file as UTF-8, BUT WITHOUT THE UTF-8 BOM HEADER; ¶\n")
file:write(string.format("local L = LibStub(\"AceLocale-3.0\"):NewLocale(\"%s\", \"%s\")\n", localeName, lang))
file:write("if not L then return end\n")
file:write("-- Generated by Babelfish script, do not add strings manually, only translate existing strings.\n")
if lang == baseLocale then
file:write("-- This is the base locale; values can be \"true\" so they default to their key, or any string to override that behaviour.\n")
file:write(string.format("local L = LibStub(\"AceLocale-3.0\"):NewLocale(\"%s\", \"%s\", true)\n", localeName, lang))
file:write("\n")
else
file:write("-- Please make sure to save the file as UTF-8, BUT WITHOUT THE UTF-8 BOM HEADER; ¶\n")
file:write(string.format("local L = LibStub(\"AceLocale-3.0\"):NewLocale(\"%s\", \"%s\")\n", localeName, lang))
file:write("if not L then return end\n")
end
file:write("\n")
local L = localizedStrings[lang]
for idx, match in ipairs(work) do
if type(L[match]) == "string" then
file:write(string.format("L[\"%s\"] = \"%s\"\n", match, L[match]))
else
local value = "true"
if type(localizedStrings[baseLocale][match]) == "string" then
value = string.format("\"%s\"", localizedStrings[baseLocale][match])
if lang ~= baseLocale then
local value = type(localizedStrings[baseLocale][match]) == "string" and localizedStrings[baseLocale][match] or "true"
file:write(string.format("-- L[\"%s\"] = %s\n", match, value))
else
file:write(string.format("L[\"%s\"] = true\n", match))
end
file:write(string.format("-- L[\"%s\"] = %s\n", match, value))
end
end
file:close()
+1
View File
@@ -1,3 +1,4 @@
-- Generated by Babelfish script, do not add strings manually, only translate existing strings.
-- Please make sure to save the file as UTF-8, BUT WITHOUT THE UTF-8 BOM HEADER; ¶
local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "deDE")
if not L then return end
+2 -1
View File
@@ -1,4 +1,5 @@
-- Generated by Babelfish script, do not edit directly.
-- Generated by Babelfish script, do not add strings manually, only translate existing strings.
-- This is the base locale; values can be "true" so they default to their key, or any string to override that behaviour.
local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "enUS", true)
+1
View File
@@ -1,3 +1,4 @@
-- Generated by Babelfish script, do not add strings manually, only translate existing strings.
-- Please make sure to save the file as UTF-8, BUT WITHOUT THE UTF-8 BOM HEADER; ¶
local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "esES")
if not L then return end
+1
View File
@@ -1,3 +1,4 @@
-- Generated by Babelfish script, do not add strings manually, only translate existing strings.
-- Please make sure to save the file as UTF-8, BUT WITHOUT THE UTF-8 BOM HEADER; ¶
local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "esMX")
if not L then return end
+1
View File
@@ -1,3 +1,4 @@
-- Generated by Babelfish script, do not add strings manually, only translate existing strings.
-- Please make sure to save the file as UTF-8, BUT WITHOUT THE UTF-8 BOM HEADER; ¶
local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "frFR")
if not L then return end
+1
View File
@@ -1,3 +1,4 @@
-- Generated by Babelfish script, do not add strings manually, only translate existing strings.
-- Please make sure to save the file as UTF-8, BUT WITHOUT THE UTF-8 BOM HEADER; ¶
local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "koKR")
if not L then return end
+1
View File
@@ -1,3 +1,4 @@
-- Generated by Babelfish script, do not add strings manually, only translate existing strings.
-- Please make sure to save the file as UTF-8, BUT WITHOUT THE UTF-8 BOM HEADER; ¶
local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "ruRU")
if not L then return end
+1
View File
@@ -1,3 +1,4 @@
-- Generated by Babelfish script, do not add strings manually, only translate existing strings.
-- Please make sure to save the file as UTF-8, BUT WITHOUT THE UTF-8 BOM HEADER; ¶
local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "zhCN")
if not L then return end
+1
View File
@@ -1,3 +1,4 @@
-- Generated by Babelfish script, do not add strings manually, only translate existing strings.
-- Please make sure to save the file as UTF-8, BUT WITHOUT THE UTF-8 BOM HEADER; ¶
local L = LibStub("AceLocale-3.0"):NewLocale("Bartender4", "zhTW")
if not L then return end