changeset 9:da9c4373da48

Fall back to english texts when translations are missing.
author madcatzinc@35b17cf1-18cd-47ff-9ca3-31d6b526ef09
date Fri, 12 Apr 2013 22:39:20 +0000
parents 971d3df34294
children 340a76af27f7
files CyborgMMO7.lua Localisation.lua
diffstat 2 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/CyborgMMO7.lua	Fri Apr 12 22:39:15 2013 +0000
+++ b/CyborgMMO7.lua	Fri Apr 12 22:39:20 2013 +0000
@@ -87,7 +87,7 @@
 function CyborgMMO_LoadWowCommands()
 	if (CyborgMMO_ProfileKeyBindings == nil) then
 		CyborgMMO_ProfileKeyBindings = {}
-		CyborgMMO_ProfileKeyBindings = CyborgMMO_InternationalWowCommands[GetLocale()]
+		CyborgMMO_ProfileKeyBindings = CyborgMMO_DefaultWowCommands
 	end
 	CyborgMMO_WowCommands = CyborgMMO_ProfileKeyBindings 
 end
--- a/Localisation.lua	Fri Apr 12 22:39:15 2013 +0000
+++ b/Localisation.lua	Fri Apr 12 22:39:20 2013 +0000
@@ -18,7 +18,7 @@
 --~ along with this program; if not, write to the Free Software
 --~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
-CyborgMMO_InternationalMode = {
+local Modes = {
 	["enUS"] = {
 		"ALT-CTRL-E",
 		"ALT-CTRL-F",
@@ -56,9 +56,7 @@
 	},
 }
 
-
-
-CyborgMMO_InternationalWowCommands = {
+local DefaultWowCommands = {
 	["enUS"] = {
 		"ALT-CTRL-NUMPAD1",
 		"ALT-CTRL-NUMPAD2",
@@ -348,7 +346,7 @@
 	},
 }
 
-CyborgMMO_InternationalStringTable = {
+local StringTables = {
 	["enUS"] = {
 		CyborgMMO_BindingFrameExitButton="Close",
 		CyborgMMO_BindingFrameHeaderText="Please press the appropriate button",
@@ -437,6 +435,15 @@
 	},
 }
 
-CyborgMMO_Mode = CyborgMMO_InternationalMode[GetLocale()]
-CyborgMMO_WowCommands = nil
-CyborgMMO_StringTable = CyborgMMO_InternationalStringTable[GetLocale()]
+local locale = GetLocale()
+-- fall back to english for missing translations
+local default_locale = 'enUS'
+
+CyborgMMO_Mode = Modes[locale] or Modes[default_locale]
+CyborgMMO_DefaultWowCommands = DefaultWowCommands[locale] or DefaultWowCommands[default_locale]
+CyborgMMO_StringTable = StringTables[locale] or StringTables[default_locale]
+
+if locale ~= default_locale then
+	setmetatable(CyborgMMO_StringTable, {__index=StringTables[default_locale]})
+end
+