All pastes #215698 Raw Edit

Mine

public text v1 · immutable
#215698 ·published 2006-10-22 19:35 UTC
rendered paste body
Index: AceLocale-2.2.lua
===================================================================
--- AceLocale-2.2.lua	(revision 14826)
+++ AceLocale-2.2.lua	(working copy)
@@ -158,12 +158,15 @@
 	AceLocale.argCheck(self, locale, 2, "string")
 	AceLocale.argCheck(self, func, 3, "function")
 	
-	if locale == rawget(self, BASE_LOCALE) then
+	if locale == rawget(self, BASE_LOCALE) and not rawget(self, DYNAMIC_LOCALES) then
 		AceLocale.error(self, "Cannot provide the same locale more than once. %q provided twice.", locale)
 	end
-	
+
 	if rawget(self, BASE_TRANSLATIONS) and GetLocale() ~= locale then
 		if rawget(self, DEBUGGING) or rawget(self, DYNAMIC_LOCALES) then
+			if not rawget(self, TRANSLATION_TABLES) then
+				rawset(self, TRANSLATION_TABLES, {})
+			end
 			if self[TRANSLATION_TABLES][locale] then
 				AceLocale.error(self, "Cannot provide the same locale more than once. %q provided twice.", locale)
 			end
@@ -253,6 +256,11 @@
 	return (next(t, position))
 end
 
+function AceLocale.prototype:HasLocale(locale)
+	AceLocale.argCheck(self, locale, 2, "string")
+	return self[TRANSLATION_TABLES][locale] ~= nil
+end
+
 function AceLocale.prototype:IterateAvailableLocales()
 	if not rawget(self, DYNAMIC_LOCALES) then
 		AceLocale.error(self, "Cannot call `IterateAvailableLocales' without first calling `EnableDynamicLocales'.")