Bug 28353 - Setting Thread CultureInfo not recognized
Summary: Setting Thread CultureInfo not recognized
Status: NEW
Alias: None
Product: Gtk#
Classification: Mono
Component: gtk-sharp ()
Version: 2.x
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-03-24 03:24 UTC by Sven
Modified: 2015-03-24 03:26 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 28353 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Sven 2015-03-24 03:24:56 UTC
Changing the CultureInfo of the current thread via following code doesn't work on windows:

Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");

I use the following code, but the language of my application is always system specified:

Catalog.Init("AudioCuesheetEditor", Path.GetFullPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + MainClass.CONST_STR_LOCALE_PATH));
[...]
//Set the locale
log.debug("CultureInfo.CurrentCulture = " + CultureInfo.CurrentCulture);
if (Program.getInstance().getObjOption().getStrSelectedLanguage() != null)
{
    log.debug("Program.getInstance().getObjOption().getStrSelectedLanguage() = " + Program.getInstance().getObjOption().getStrSelectedLanguage());
    Thread.CurrentThread.CurrentCulture = new CultureInfo(Program.getInstance().getObjOption().getStrSelectedLanguage());
    if (Environment.OSVersion.Platform == PlatformID.Unix)
    {
        //Mono Linux hack
        Environment.SetEnvironmentVariable("LANGUAGE", Program.getInstance().getObjOption().getStrSelectedLanguage().Replace("-", "_"));
    }
}
Application.Init();
[...]
Application.Run();
Comment 1 Sven 2015-03-24 03:26:21 UTC
On linux, the hack works fine and the language of the application is changed. If I try this on windows, nothing happens. If I open cmd.exe and enter "SET LANG=en" and afterwards open my application, the language is changed.