Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Exception cultureInfo

$
0
0

Xamarin.Forms 1.5
Xamarin.iOS 9

Using http://developer.xamarin.com/guides/cross-platform/xamarin-forms/localization/#iOS_Application_Project

  public System.Globalization.CultureInfo GetCurrentCultureInfo ()
  {
      var netLanguage = "en";
      if (NSLocale.PreferredLanguages.Length > 0) {
          var pref = NSLocale.PreferredLanguages [0];
          netLanguage = pref.Replace ("_", "-"); // turns es_ES into es-ES

          if (pref == "pt")
              pref = "pt-BR"; // get the correct Brazilian language strings from the PCL RESX
          //(note the local iOS folder is still "pt")
      }
      return new System.Globalization.CultureInfo(netLanguage);

Returns this error:

Culture name en-ES is not supported.
Parameter name: name


Viewing all articles
Browse latest Browse all 77050

Trending Articles