Permalink
Browse files

add localcheck

update enUS locale
  • Loading branch information...
1 parent e4e47e4 commit 98453e0b1336d83e71aab25331b804eef5954cad @wolftankk committed May 14, 2012
Showing with 130 additions and 53 deletions.
  1. +3 −0 .pkgmeta
  2. +86 −0 localcheck.lua
  3. +36 −47 locale/enUS.lua
  4. +4 −4 modules/raidTarget.lua
  5. +1 −2 modules/style.lua
View
@@ -8,3 +8,6 @@ externals:
Libs/AceGUI-3.0-SharedMediaWidgets: svn://svn.wowace.com/wow/ace-gui-3-0-shared-media-widgets/mainline/trunk/AceGUI-3.0-SharedMediaWidgets
Libs/LibDBIcon-1.0: svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk/LibDBIcon-1.0
Libs/LibDataBroker-1.1: git://git.wowace.com/wow/libdatabroker-1-1/mainline.git
+ignore:
+ - base.lua
+ - localcheck.lua
View
@@ -0,0 +1,86 @@
+local localeName = "Icetip";
+
+local files = {
+ "Icetip.lua",
+ "options.lua",
+ "modules/fade.lua",
+ "modules/healthbar.lua",
+ "modules/itemref.lua",
+ "modules/mousetarget.lua",
+ "modules/position.lua",
+ "modules/powerbar.lua",
+ "modules/raidTarget.lua",
+ "modules/style.lua"
+}
+
+local locale = {}
+local baseLocale = "base"
+
+local strings = {}
+
+-- extract data from specified lua files
+for idx,filename in pairs(files) do
+ local file = io.open(string.format("%s%s", filePrefix or "", filename), "r")
+ assert(file, "Could not open " .. filename)
+ local text = file:read("*all")
+
+ for match in string.gmatch(text, "L%[\"(.-)\"%]") do
+ strings[match] = true
+ end
+end
+
+local work = {}
+
+for k,v in pairs(strings) do table.insert(work, k) end
+table.sort(work)
+
+local AceLocaleHeader = "local L ="
+local BabbleFishHeader = "L = {} -- "
+
+local function replaceHeader(content)
+ return content:gsub(AceLocaleHeader, BabbleFishHeader):gsub("\\", "\\\\"):gsub("\\\"", "\\\\\"")
+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")
+ assert(file, "Could not open ".. lang .. ".lua for reading")
+ local content = file:read("*all")
+ content = replaceHeader(content)
+ --print(content)
+ assert(loadstring(content))()
+ localizedStrings[lang] = L or {}
+ file:close()
+end
+
+-- 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("-- Locale是自动生成的, 请不要乱加字符. 否则会出现字符串不存在错误.\n")
+ if lang == baseLocale then
+ file:write(string.format("local L = LibStub(\"AceLocale-3.0\"):NewLocale(\"%s\", \"%s\", true)\n", localeName, lang))
+ file:write("\n")
+ else
+ --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
+ 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
+ end
+ end
+ file:close()
+end
View
@@ -1,6 +1,7 @@
local L = LibStub("AceLocale-3.0"):NewLocale("Icetip","enUS", true)
L["Active Talent: "] = true
+L["Always"] = true
L["Anchor"] = true
L["Background color"] = true
L["Background color for dead units."] = true
@@ -21,40 +22,38 @@ L["Border style"] = true
L["Bottom"] = true
L["Bottom Left"] = true
L["Bottom Right"] = true
-L["Bottom-left"] = true
-L["Bottom-right"] = true
L["Center"] = true
-L["Change how the raid target icon shows."] = true
-L["Change how the tooltip appearance in grneral."] = true
-L["Change how the tooltip fades."] = true
L["Change the background texture.\n\n\Note:You may need to change the Background color to white to see some of the backgrounds properly."] = true
L["Change the border texture.\n\nNote: You may need to change the Background color to white to see some of the backgrounds properly."] = true
L["Change what size is the font."] = true
-L["Change where is the tooltip is showed."] = true
-L["Colored tooltip border"] = true
+L["Color border by class"] = true
L["Currently watched faction"] = true
L["Dead"] = true
L["Enable"] = true
+L["Enable/Disable colored the tooltip border by the target's class"] = true
L["Enable/Disable custom background color"] = true
-L["Enable/Disable show target of target"] = true
-L["Enable/Disable show target's talent"] = true
+L["Enable/Disable display target of target"] = true
+L["Enable/Disable display the target's equipped item level"] = true
+L["Enable/Disable display the target's talent"] = true
L["Enable/Disable to show a npc's reputation information between you"] = true
L["Fadeout"] = true
-L["Fadeout configure"] = true
L["Font"] = true
L["Font size"] = true
+L["Format health value"] = true
+L["Format power value"] = true
L["Frame"] = true
L["Friendly NPCs"] = true
L["Friendly players"] = true
L["General"] = true
+L["General settings"] = true
L["Guild and friends"] = true
-L["Health bar"] = true
L["Health bar text"] = true
+L["HealthBar"] = true
L["Hide"] = true
L["Horizontal offset"] = true
L["Hostile NPCs"] = true
L["Hostile players"] = true
-L["Icetip"] = true
+L["Item"] = true
L["Left"] = true
L["Mouse Bottom"] = true
L["Mouse Bottom Left"] = true
@@ -65,14 +64,16 @@ L["Mouse Top"] = true
L["Mouse Top Left"] = true
L["Mouse Top Right"] = true
L["Neutral NPCs"] = true
+L["Never"] = true
L["Non-unit frames"] = true
L["Not Specified"] = true
-L["Num"] = true
-L["Num(precent)"] = true
+L["Number"] = true
+L["Number(precent)"] = true
+L["Only show with modifiekey"] = true
L["Options for the frame mouseover tooltips(spells, items, etc.)"] = true
-L["Options for the tooltip's status bar."] = true
L["Options for unit mouseover tooltips(NPC, target, player, etc.)"] = true
L["Other"] = true
+L["Out of combat"] = true
L["Parent Bottom"] = true
L["Parent Bottom Left"] = true
L["Parent Bottom Right"] = true
@@ -84,9 +85,9 @@ L["Parent Top Right"] = true
L["Percent"] = true
L["Position"] = true
L["Position of the raid target icon."] = true
-L["Power bar"] = true
L["Power bar text"] = true
-L["Raid target icon"] = true
+L["PowerBar"] = true
+L["RaidTarget"] = true
L["Rare"] = true
L["Right"] = true
L["Scale"] = true
@@ -95,18 +96,25 @@ L["Set how large the tooltip is."] = true
L["Sets anchor offset"] = true
L["Sets offset of the X"] = true
L["Sets offset of the Y"] = true
-L["Sets the text style."] = true
-L["Sets the tooltip's style"] = true
L["Sets what color the tooltip's background is."] = true
L["Sets what color the tooltip's border is."] = true
L["Sets what size the tooltip's backgroud texture tile"] = true
L["Sets what texture tile the tooltip's background is."] = true
+L["Show minimap icon"] = true
L["Show the status text on the power bar."] = true
+L["Show the tooltip for non-unit framers if..."] = true
+L["Show the tooltip for unit frames if..."] = true
+L["Show the tooltip for world objects if..."] = true
+L["Show the tooltip for world units if..."] = true
+L["Show the tooltip if the specified modifier is being held down"] = true
+L["Show tooltips"] = true
L["Size"] = true
L["Size of the raid target icon."] = true
-L["Status bar"] = true
+L["Smarty"] = true
+L["Smarty(precent)"] = true
+L["Style"] = true
L["Tapped"] = true
-L["Text style"] = true
+L["Text format"] = true
L["Texture"] = true
L["The anchor with which the tooltips are showed."] = true
L["The position of the health bar relative to the tooltip."] = true
@@ -117,25 +125,22 @@ L["The size the border takes up."] = true
L["The texture which the health bar uses."] = true
L["The texture which the power bar uses."] = true
L["Tile size"] = true
+L["Toggle %s module."] = true
L["Toggle custom background color"] = true
+L["Toggle show item level"] = true
L["Toggle show npc faction"] = true
+L["Toggle show talent"] = true
L["Toggle show target of target"] = true
-L["Toggle show target's talent"] = true
-L["Toggle show the raid target icon on the tooltip."] = true
L["Toggle show the status text on the health bar."] = true
-L["Toggle the health bar on the tooltip."] = true
-L["Toggle the power bar on the tooltip."] = true
-L["Tooltip Bottom"] = true
L["Tooltip Left"] = true
L["Tooltip Right"] = true
-L["Tooltip Top"] = true
+L["Tooltip bottom"] = true
L["Tooltip inner"] = true
-L["Tooltip's style configure"] = true
+L["Tooltip top"] = true
+L["TooltipInfo"] = true
L["Top"] = true
L["Top Left"] = true
L["Top Right"] = true
-L["Top-left"] = true
-L["Top-right"] = true
L["Unit"] = true
L["Unit frames"] = true
L["Vertical offset"] = true
@@ -147,22 +152,6 @@ L["What kind of fade to use for world units (other players, NPC in the world, et
L["When you watch a item, colored tooltip by item's quality color"] = true
L["World objects"] = true
L["World units"] = true
-L["[Target] "] = true
L["|cffFFAAFF(Rare Boss)|r"] = true
L["|cffff0000>YOU<|r"] = true
-L["|cffffd200Version: "] = true
-L["Show minimap icon"] = true
-L["Show the icon on the minimap"] = true
-L["Color border by class"] = true
-L["Enable/Disable colored the tooltip border by the player's class"] = true
-L["Always"] = true
-L["Out of combat"] = true
-L["Never"] = true
-L["Show tooltips"] = true
-L["Show the tooltip for world units if..."] = true
-L["Show the tooltip for world objects if..."] = true
-L["Show the tooltip for unit frames if..."] = true
-L["Show the tooltip for non-unit framers if..."] = true
-L["Only show with modifiekey"] = true
-L["Show the tooltip if the specified modifier is being held down"] = true
-L["Toggle %s module."] = true
+L["|cffffd200Version: "] = true
View
@@ -103,10 +103,10 @@ function mod:GetOptions()
RIGHT = L["Right"],
TOP = L["Top"],
BOTTOM = L["Bottom"],
- TOPLEFT = L["Top-left"],
- TOPRIGHT = L["Top-right"],
- BOTTOMLEFT = L["Bottom-left"],
- BOTTOMRIGHT = L["Bottom-right"]
+ TOPLEFT = L["Top Left"],
+ TOPRIGHT = L["Top Right"],
+ BOTTOMLEFT = L["Bottom Left"],
+ BOTTOMRIGHT = L["Bottom Right"]
},
get = function() return db.position end,
set = function(_, v)
View
@@ -209,8 +209,7 @@ function mod:GetOptions()
tooltipBG = {
type = "group",
order = 1,
- name = L["Tooltip's style configure"],
- desc = L["Sets the tooltip's style"],
+ name = L["Style"],
inline = true,
args = {
bgtexture = {

0 comments on commit 98453e0

Please sign in to comment.