Search code examples
c#windows-phone-7windows-phone-7.1localewindows-phone

Internationalize Windows Phone 7 App


I am currently working on a windows phone application that takes some information from the user and returns some other information based on the user input.

The application works great if the specific device has its region settings set to US. If the region settings of the device are set to Greek or German, some problems occur. For example, the US decimal point character "." is considered as "," and vice versa. As a result, all the calculations are false.

What I want to do is internationalize the application so that it works exactly the same no matter what the regional settings are. Is this possible?


Solution

  • If you want your app allways to show number and dates in one specify format you can force the app to allways run in one specify culture like this.

    You just have to set the current thread of your app to one specify culture (add to the App.cs file)!

        public App()
        {
            // Standard Silverlight initialization
            InitializeComponent();
    
            // Phone-specific initialization
            InitializePhoneApplication();
    
            // Set the current thread to US!
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");