Ejemplo n.º 1
0
        /// <summary>
        /// Checks if we have a localization for the specified language and if not falls back
        /// the CurrentCulture and CurrentUICulture to the ones defined in the default resources.
        /// It also sets the language of the root visual. This affects all converters in data bindings.
        /// </summary>
        /// <param name="app"></param>
        /// <param name="forcedCulture">Two Letter ISO Language Name</param>
        /// <remarks>This method should be called after App.InitializeComponent() </remarks>
        public static void InitializeCulture(this Application app, SupportedCultures forcedCulture)
        {
            var forcedLanguageName = "en-US";

            if (forcedCulture == SupportedCultures.Japanese)
            {
                forcedLanguageName = "ja-JP";
            }

            app.InitializeCulture(forcedLanguageName);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Checks if we have a localization for the specified language and if not falls back
 /// the CurrentCulture and CurrentUICulture to the ones defined in the default resources.
 /// It also sets the language of the root visual. This affects all converters in data bindings.
 /// </summary>
 /// <param name="app"></param>
 /// <param name="forcedLanguageName">Four Letter Language Name, e.g. "en-US", "en"</param>
 /// <remarks>This method should be called after App.InitializeComponent() </remarks>
 public static void InitializeCulture(this Application app, string forcedLanguageName)
 {
     if ((forcedLanguageName.Length == 5 && forcedLanguageName.Contains("-") ||
          forcedLanguageName.Length == 2))
     {
         var forcedCultur = new CultureInfo(forcedLanguageName);
         app.InitializeCulture(forcedCultur);
     }
     else
     {
         DebugManager.LogWarning("ApplicationEx.InitializeCulture() called with invalid forcedLanguageName parameter: " + forcedLanguageName);
     }
 }
Ejemplo n.º 3
0
 public static void TestEnglishCulture(this Application app)
 {
     app.InitializeCulture(SupportedCultures.English);
 }
Ejemplo n.º 4
0
 public static void TestJapaneseCulture(this Application app)
 {
     app.InitializeCulture(SupportedCultures.Japanese);
 }