From fa56f2787c852c78ea55c1856be09b69bd3134d2 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Mon, 29 Sep 2008 11:23:31 +0200 Subject: [PATCH] Some more tweaks to Babelfish script, changing output format slightly, and re-run the script. --- locale/Babelfish.lua | 38 +++++++++++++++----------------------- locale/deDE.lua | 1 + locale/enUS.lua | 3 ++- locale/esES.lua | 1 + locale/esMX.lua | 1 + locale/frFR.lua | 1 + locale/koKR.lua | 1 + locale/ruRU.lua | 1 + locale/zhCN.lua | 1 + locale/zhTW.lua | 1 + 10 files changed, 25 insertions(+), 24 deletions(-) diff --git a/locale/Babelfish.lua b/locale/Babelfish.lua index d88546e..1daada3 100644 --- a/locale/Babelfish.lua +++ b/locale/Babelfish.lua @@ -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() diff --git a/locale/deDE.lua b/locale/deDE.lua index ddef20d..d6afcad 100644 --- a/locale/deDE.lua +++ b/locale/deDE.lua @@ -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 diff --git a/locale/enUS.lua b/locale/enUS.lua index 4f5c0ed..865d1dd 100644 --- a/locale/enUS.lua +++ b/locale/enUS.lua @@ -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) diff --git a/locale/esES.lua b/locale/esES.lua index d3d128a..5b33f5b 100644 --- a/locale/esES.lua +++ b/locale/esES.lua @@ -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 diff --git a/locale/esMX.lua b/locale/esMX.lua index bbea81f..1d503f4 100644 --- a/locale/esMX.lua +++ b/locale/esMX.lua @@ -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 diff --git a/locale/frFR.lua b/locale/frFR.lua index 880bd55..74c2bcb 100644 --- a/locale/frFR.lua +++ b/locale/frFR.lua @@ -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 diff --git a/locale/koKR.lua b/locale/koKR.lua index a20aeee..c88ddfe 100644 --- a/locale/koKR.lua +++ b/locale/koKR.lua @@ -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 diff --git a/locale/ruRU.lua b/locale/ruRU.lua index fccff8e..99ff012 100644 --- a/locale/ruRU.lua +++ b/locale/ruRU.lua @@ -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 diff --git a/locale/zhCN.lua b/locale/zhCN.lua index df9abcf..7885c19 100644 --- a/locale/zhCN.lua +++ b/locale/zhCN.lua @@ -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 diff --git a/locale/zhTW.lua b/locale/zhTW.lua index d016297..5b2ff53 100644 --- a/locale/zhTW.lua +++ b/locale/zhTW.lua @@ -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