comparison Lang/Translation.cs @ 7:f4da31cb09d9

* Add translation DTD to utils project * Alter Translation class to resolve error when initialising with an empty local language (should default to no local language, not exception) no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Fri, 02 Jan 2009 20:12:06 +0000
parents f269d8bcc152
children d6ce8764e92b
comparison
equal deleted inserted replaced
6:f269d8bcc152 7:f4da31cb09d9
134 /// Loads translations for a given language and sets them as the local language 134 /// Loads translations for a given language and sets them as the local language
135 /// </summary> 135 /// </summary>
136 /// <param name="translationLang"> 136 /// <param name="translationLang">
137 /// The new local language to load 137 /// The new local language to load
138 /// </param> 138 /// </param>
139 public static void LoadTranslation(string translationLang) 139 public static void LoadTranslation(string translationLanguage)
140 {
141 if (translationLanguage == "" || translationLanguage == null)
142 {
143 throw new ArgumentException("Translation language cannot be empty or null");
144 }
145
146 LoadTranslationForLang(translationLanguage);
147 }
148
149 private static void LoadTranslationForLanguage(string translationLanguage)
140 { 150 {
141 checkInitialisation(); 151 checkInitialisation();
142 152
143 if (translationLang == "" || translationLang == null) 153 if (translationLanguage != DEFAULT_LANGUAGE && translationLanguage != "" && translationLanguage != null)
144 {
145 throw new ArgumentException("Translation language cannot be empty or null");
146 }
147
148 if (translationLang != DEFAULT_LANGUAGE)
149 { 154 {
150 FileInfo file = GetTranslationFile(translationLang); 155 FileInfo file = GetTranslationFile(translationLang);
151 XmlDocument doc = LoadTranslationDocument(file); 156 XmlDocument doc = LoadTranslationDocument(file);
152 LoadTranslationsFromDocument(doc, translationsLocal); 157 LoadTranslationsFromDocument(doc, translationsLocal);
153 } 158 }