/// <summary> /// </summary> /// <param name="cultureInfo"> </param> public static void Update(CultureInfo cultureInfo) { var culture = cultureInfo.TwoLetterISOLanguageName; ResourceDictionary dictionary; if (Constants.Supported.Contains(culture)) { switch (culture) { case "fr": dictionary = French.Context(); break; case "ja": dictionary = Japanese.Context(); break; case "de": dictionary = German.Context(); break; case "zh": dictionary = Chinese.Context(); break; case "ru": dictionary = Russian.Context(); break; case "ko": dictionary = Korean.Context(); break; default: dictionary = English.Context(); break; } } else { dictionary = English.Context(); } var locale = dictionary.Cast <DictionaryEntry>() .ToDictionary(item => (string)item.Key, item => (string)item.Value); AppViewModel.Instance.Locale = locale; foreach (var pluginInstance in App.Plugins.Loaded.Cast <PluginInstance>() .Where(pluginInstance => pluginInstance.Loaded)) { pluginInstance.Instance.Locale = locale; } }
/// <summary> /// </summary> /// <param name="cultureInfo"> </param> public static void Update(CultureInfo cultureInfo) { var culture = cultureInfo.TwoLetterISOLanguageName; Dictionary <string, string> dictionary; if (Constants.Supported.Contains(culture)) { switch (culture) { case "fr": dictionary = French.Context(); break; case "ja": dictionary = Japanese.Context(); break; case "de": dictionary = German.Context(); break; case "zh": dictionary = Chinese.Context(); break; case "ru": dictionary = Russian.Context(); break; case "ko": dictionary = Korean.Context(); break; default: dictionary = English.Context(); break; } } else { dictionary = English.Context(); } AppViewModel.Instance.Locale = dictionary; foreach (PluginInstance pluginInstance in App.Plugins.Loaded.Cast <PluginInstance>().Where(pluginInstance => pluginInstance.Loaded)) { pluginInstance.Instance.Locale = dictionary; } }