static DNMultiLanguage() { switch (CultureInfo.InstalledUICulture.ThreeLetterISOLanguageName) { case "nob": _type = DNLanguageType.Norwegian_Bokmal; break; case "eng": _type = DNLanguageType.English; break; case "swe": _type = DNLanguageType.Swedish; break; case "ger": _type = DNLanguageType.German; break; case "dan": _type = DNLanguageType.Danish; break; case "fin": _type = DNLanguageType.Finnish; break; default: _type = DNLanguageType.Norwegian_Bokmal; break; } //Init(ResourceLoader.GetEmbeddedResourceString(typeof(DNMultiLanguage).Assembly, "language.xml")); }
/// <summary> /// Finds the correct message, and returns it /// </summary> /// <param name="id">The id of the message to return</param> /// <param name="language">The language of the message to return</param> /// <returns>The message corresponding to the id and language given as parameters</returns> public static string GetMessage(string id, DNLanguageType language) { string _id = id.ToLower(); if (Messages.ContainsKey(_id) && Messages[_id].ContainsKey(language)) { var message = Messages[_id][language]; return(!string.IsNullOrEmpty(message) ? message : Messages[_id][DNGlobalProperties.Current.DefaultLanguage]); } return(id); }