/// <summary> /// Thread-safe access to the AvailableCultures list. /// </summary> /// <param name="c">The CultureInfo.</param> protected void AddCulture(CultureInfo c) { lock (AvailableCultureListLock) { if (!AvailableCultures.Contains(c)) { AvailableCultures.Add(c); } } }
public static void ChangeCulture(CultureInfo culture) { if (AvailableCultures.Contains(culture)) { Resources.Culture = culture; ResourceProvider.Refresh(); } else { System.Diagnostics.Debug.WriteLine(string.Format("Culture [{0}] not available", culture)); } }
internal static void SetAppCulture() { if (TCPlayer.Properties.Settings.Default.CultureOverride != null) { try { CultureInfo @override = TCPlayer.Properties.Settings.Default.CultureOverride; if (AvailableCultures.Contains(@override)) { TCPlayer.Properties.Resources.Culture = @override; } else { TCPlayer.Properties.Settings.Default.CultureOverride = CultureInfo.InvariantCulture; } } catch (Exception) { TCPlayer.Properties.Settings.Default.CultureOverride = CultureInfo.InvariantCulture; } } }