Beispiel #1
0
 private static void InitAs(CultureInfo ci, LanguageStrings[] languages)
 {
     foreach (LanguageStrings strings in languages)
     {
         if (strings.LanguageName == ci.Name)
         {
             _strings = strings;
             return;
         }
     }
 }
Beispiel #2
0
        ///  <summary>
        ///  Will attempt to load a language file based off of the provided culture, otherwise it will default to either the system culture, en-us, or the first one avalaible.
        ///  </summary>
        public static void InitDefaultAs(CultureInfo ci)
        {
            var languages = LanguageStrings.GetAvalableLanguages();

            if (languages.Length == 0)
            {
                throw new Exception("No lanuage files found!");
            }
            if (languages.Length == 1)
            {
                _strings = languages[0];
            }
            InitAs(ci, languages);
        }
Beispiel #3
0
        public static void InitDefault()
        {
            var languages = LanguageStrings.GetAvalableLanguages();

            if (languages.Length == 0)
            {
                throw new Exception("No lanuage files found!");
            }
            if (languages.Length == 1)
            {
                _strings = languages[0];
                return;
            }
            InitAs(CultureInfo.CurrentUICulture, languages);
            if (_strings == null)
            {
                _strings = languages[0];
            }
        }