Mercurial > repos > IBBoard
changeset 67:5fb2e5a2e7a8
* Remove errors on uninitialised translations - means that the translations just fall back to the provided string if they haven't been initialised
no-open-ticket
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Wed, 17 Feb 2010 20:10:27 +0000 |
parents | 7e5f5cb0a9ea |
children | ecf3ce7bd6c5 |
files | Lang/Translation.cs |
diffstat | 1 files changed, 3 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/Lang/Translation.cs Thu Dec 24 13:57:03 2009 +0000 +++ b/Lang/Translation.cs Wed Feb 17 20:10:27 2010 +0000 @@ -26,8 +26,8 @@ private static readonly string DIVIDER_STRING = "-"; private static string lang = ""; private static DirectoryInfo translationDir; - private static Dictionary<string, string> translationsLocal; - private static Dictionary<string, string> translationsDefault; + private static Dictionary<string, string> translationsLocal = new Dictionary<string, string>(); + private static Dictionary<string, string> translationsDefault = new Dictionary<string, string>(); private static XmlReaderSettings settings; /// <summary> @@ -200,9 +200,7 @@ } private static void LoadTranslationForLanguage(string translationLanguage) - { - CheckInitialisation(); - + { if (translationLanguage != DEFAULT_LANGUAGE && translationLanguage != "" && translationLanguage != null) { FileInfo file = GetTranslationFile(translationLanguage); @@ -271,7 +269,6 @@ /// </returns> public static string GetTranslation(string translationID, string defaultTranslation, params object[] replacements) { - CheckInitialisation(); string trans = GetTranslationFromTables(translationID); if (trans == null) @@ -320,14 +317,6 @@ return translation; } - - private static void CheckInitialisation() - { - if (translationDir==null) - { - throw new InvalidOperationException("Translation class has not been initialised"); - } - } /// <summary> /// Translate an <see cref="ITranslatable"/> item, with optional string replacement. If the translation