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

XAML Localization not working

$
0
0

Hi! I have no experience in Xamain, so maybe my question is dumb, but here it is:

I use the https://developer.xamarin.com/guides/cross-platform/xamarin-forms/localization/ link to setup localization in my app. And it is working when I localize in code. But in XAML I have the following problem. I wrote the Localization class in Android, that looks like this:

  public class Localize : Localization.ILocalize {
        public System.Globalization.CultureInfo GetCurrentCultureInfo() {
            var androidLocale = Java.Util.Locale.Default;
            var netLanguage = androidLocale.ToString().Replace( "_", "-" ); // turns pt_BR into pt-BR
            return new System.Globalization.CultureInfo( netLanguage );
        }
    }

But when I try to build, it shows me the following message:
Error CS0012 The type 'CultureInfo' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Globalization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. WinGymAndroid.Droid C:\Projects\Xamarin\WinGymAndroid\WinGymAndroid\WinGymAndroid.Droid\Localize.cs

My ILocalize interface is:
public interface ILocalize {
CultureInfo GetCurrentCultureInfo();
}

This is Xamarin.Forms project. My platform is: Windows 10, Visual Studio 2015 with installed Xamarin.


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>