Quantcast

Localized config.lua

Kevin Lyles [05-25-10 - 19:20]
Localized config.lua
Filename
Locales/enUS/base.lua
Locales/enUS/enUS.xml
config.lua
diff --git a/Locales/enUS/base.lua b/Locales/enUS/base.lua
new file mode 100644
index 0000000..f6ac7d2
--- /dev/null
+++ b/Locales/enUS/base.lua
@@ -0,0 +1,20 @@
+if GetLocale() ~= "enUS" then
+	return
+end
+
+local L = ww_localization
+
+-- Strings in config.lua
+L["WW_VERSION"] = "WeightsWatcher version: %s"
+L["ACCT_VERSION"] = "  Account data version: %d%s%d"
+L["CHAR_VERSION"] = "  Character data version: %d%s%d"
+L["HELP_TEXT_HEADER"] = "WeightsWatcher help:"
+L["HELP_TEXT_GENERAL"] = "Type /weightswatcher <arg> (or /ww <arg>)"
+L["HELP_TEXT_CONFIG"] = "  config      opens the main configuration window"
+L["HELP_TEXT_WEIGHTS"] = "  weights   opens the weights configuration window"
+L["HELP_TEXT_VERSION"] = "  version    displays version information"
+L["HELP_TEXT_HELP"] = "  help         displays this message"
+L["config"] = "config"
+L["version"] = "version"
+L["weights"] = "weights"
+L["DECIMAL_SEPARATOR"] = "."
diff --git a/Locales/enUS/enUS.xml b/Locales/enUS/enUS.xml
index 3593f3e..907a5b9 100644
--- a/Locales/enUS/enUS.xml
+++ b/Locales/enUS/enUS.xml
@@ -1,5 +1,6 @@
 <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 		xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\FrameXML\UI.xsd">
+	<Script file="base.lua"/>
 	<Script file="gems.lua"/>
 	<Script file="stats.lua"/>
 </Ui>
\ No newline at end of file
diff --git a/config.lua b/config.lua
index 9047495..566a235 100644
--- a/config.lua
+++ b/config.lua
@@ -1,14 +1,16 @@
+local L = ww_localization
+
 local function printHelp()
-	print("WeightsWatcher help:")
-	print("Type /weightswatcher <arg> (or /ww <arg>)")
-	print("  config      opens the main configuration window")
-	print("  weights   opens the weights configuration window")
-	print("  version    displays version information")
-	print("  help         displays this message")
+	print(L["HELP_TEXT_HEADER"])
+	print(L["HELP_TEXT_GENERAL"])
+	print(L["HELP_TEXT_CONFIG"])
+	print(L["HELP_TEXT_WEIGHTS"])
+	print(L["HELP_TEXT_VERSION"])
+	print(L["HELP_TEXT_HELP"])
 end

 function ww_commandHandler(msg)
-	if msg == "config" then
+	if msg == L["config"] then
 		ww_weights:Hide()
 		-- TODO: make this work better with the confirmDiscardChanges dialog
 		if ww_weights:IsShown() then
@@ -19,7 +21,7 @@ function ww_commandHandler(msg)
 		else
 			ww_config:Show()
 		end
-	elseif msg == "weights" then
+	elseif msg == L["weights"] then
 		ww_config:Hide()
 		if ww_config:IsShown() then
 			return
@@ -29,10 +31,10 @@ function ww_commandHandler(msg)
 		else
 			ww_weights:Show()
 		end
-	elseif msg == "version" then
-		print("WeightsWatcher version: " .. WeightsWatcher.version)
-		print("  Account data version: " .. ww_vars.dataMajorVersion .. "." .. ww_vars.dataMinorVersion)
-		print("  Character data version: " .. ww_charVars.dataMajorVersion .. "." .. ww_charVars.dataMinorVersion)
+	elseif msg == L["version"] then
+		print(string.format(L["WW_VERSION"], WeightsWatcher.version))
+		print(string.format(L["ACCT_VERSION"], ww_vars.dataMajorVersion, L["DECIMAL_SEPARATOR"], ww_vars.dataMinorVersion))
+		print(string.format(L["CHAR_VERSION"], ww_charVars.dataMajorVersion, L["DECIMAL_SEPARATOR"], ww_charVars.dataMinorVersion))
 	else
 		printHelp()
 	end