Ejemplo n.º 1
0
        public static void ChangeCulture(string CultureName)
        {
            CultureInfo culture = SupportedCultures.SingleOrDefault(x => x.Name == CultureName);

            if (culture != null)
            {
                CurrentCulture = culture;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Load last used culture from application settings.
 /// </summary>
 private static void LoadCulture()
 {
     if (IsolatedStorageSettings.ApplicationSettings.Contains("CurrentCulture"))
     {
         // Load previously saved culture from app settings
         var savedCulture = (string)IsolatedStorageSettings.ApplicationSettings["CurrentCulture"];
         CurrentCulture = SupportedCultures.SingleOrDefault(info => info.ToString() == savedCulture);
     }
     else
     {
         // Determine user's current culture setting and if it is in the supported list - use it, or fallback to default culture
         var culture =
             SupportedCultures.FirstOrDefault(info => info.TwoLetterISOLanguageName == CurrentCulture.TwoLetterISOLanguageName);
         CurrentCulture = culture ?? DefaultCulture;
     }
 }