Where does the default culture get set in a .NET application

serlingpa

I am writing a WPF app and am having some difficulty with cultures.

I'd like to know where .NET applications pick up the value for CurrentThread.CurrentCulture when no value is explicitly set. It's not from the Windows culture info because I have changed that from en-US to en-GB without noticing any change in the application when running.

Please help!

Mark

ta.speot.is

From the fine manual:

See the CultureInfo.CurrentCulture property to learn how a thread's default culture is determined, and how users set culture information for their computers.

One laborious click later...

How a Thread's Culture Is Determined

When a thread is started, its culture is initially determined as follows:

  • By retrieving the culture that is specified by the DefaultThreadCurrentCulture property in the application domain in which the thread is executing, if the property value is not null.

  • By calling the Windows GetUserDefaultLocaleName function.

Note that if you set a specific culture that is different from the system-installed culture or the user's preferred culture, and your application starts multiple threads, the current culture of those threads will be the culture that is returned by the GetUserDefaultLocaleName function, unless you assign a culture to the DefaultThreadCurrentCulture property in the application domain in which the thread is executing.

For more information about how the culture of a thread is determined, see the "Culture and Threads" section in the CultureInfo topic.

I didn't budget for another click, but clicked anyway.

Culture and Threads

When a new application thread is started, its current culture and current UI culture are defined by the current system culture, and not by the current thread culture. The following example illustrates the difference. It sets the current culture and current UI culture of an application thread to the French (France) culture (fr-FR). If the current culture is already fr-FR, the example sets it to the English (United States) culture (en-US). It displays three random numbers as currency values and then creates a new thread, which, in turn, displays three more random numbers as currency values. But as the output from the example shows, the currency values displayed by the new thread do not reflect the formatting conventions of the French (France) culture, unlike the output from the main application thread.

Note that it says when a new application thread is started. So, given that you say:

It's not from the Windows culture info because I have changed that from en-US to en-GB without noticing any change in the application when running.

You might want to review this answer.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

.Net MVC4 Culture set correct, but validation still English

From Dev

where does Application Pool get stored

From Dev

ASP.NET Web Application Does not Autoredirect to Default.aspx

From Dev

Where does Spring Security get its default http configuration from?

From Dev

Why does IIS7 Invariant Culture is default to en-US?

From Dev

How to get default application for an action

From Dev

Set application default payment service

From Dev

Where to set the OAuth redirect_uri in ASP.NET 4.5 webforms application

From Dev

Where is the default database created for C# MVC ASP.NET application?

From Dev

Set default application on AOSP

From Dev

Where can I get/set the application id?

From Dev

Cannot set default and only culture in ASP.Net Core app

From Dev

Default threading model for a .Net application

From Dev

MYSQL - set default as NULL to all columns, where default is not set

From Dev

Where does the TERM environment variable default get set?

From Dev

After doing a sudo apt-get install <app>, where does the application get stored to?

From Dev

Where does firefox get the “default” applications for opening files from?

From Dev

Where does the TERM environment variable default get set?

From Dev

where does Application Pool get stored

From Dev

How to get default application for an action

From Dev

Where does crontab get the email address of the user it emails / where are user email addresses set?

From Dev

Is it possible to set a portable application as default?

From Dev

Where does Linux set the default values for SHMMAX?

From Dev

Where can I get/set the application id?

From Dev

Where does $PATH get set in OS X 10.6 Snow Leopard?

From Dev

Cannot set default and only culture in ASP.Net Core app

From Dev

Where does IIS Express get its default applicationhost.config from?

From Dev

Where should I change/set culture info settings in my WPF app and why? (Must works on all .NET frameworks 4.0 and newer)

From Dev

Set default application by extension not mimetype

Related Related

  1. 1

    .Net MVC4 Culture set correct, but validation still English

  2. 2

    where does Application Pool get stored

  3. 3

    ASP.NET Web Application Does not Autoredirect to Default.aspx

  4. 4

    Where does Spring Security get its default http configuration from?

  5. 5

    Why does IIS7 Invariant Culture is default to en-US?

  6. 6

    How to get default application for an action

  7. 7

    Set application default payment service

  8. 8

    Where to set the OAuth redirect_uri in ASP.NET 4.5 webforms application

  9. 9

    Where is the default database created for C# MVC ASP.NET application?

  10. 10

    Set default application on AOSP

  11. 11

    Where can I get/set the application id?

  12. 12

    Cannot set default and only culture in ASP.Net Core app

  13. 13

    Default threading model for a .Net application

  14. 14

    MYSQL - set default as NULL to all columns, where default is not set

  15. 15

    Where does the TERM environment variable default get set?

  16. 16

    After doing a sudo apt-get install <app>, where does the application get stored to?

  17. 17

    Where does firefox get the “default” applications for opening files from?

  18. 18

    Where does the TERM environment variable default get set?

  19. 19

    where does Application Pool get stored

  20. 20

    How to get default application for an action

  21. 21

    Where does crontab get the email address of the user it emails / where are user email addresses set?

  22. 22

    Is it possible to set a portable application as default?

  23. 23

    Where does Linux set the default values for SHMMAX?

  24. 24

    Where can I get/set the application id?

  25. 25

    Where does $PATH get set in OS X 10.6 Snow Leopard?

  26. 26

    Cannot set default and only culture in ASP.Net Core app

  27. 27

    Where does IIS Express get its default applicationhost.config from?

  28. 28

    Where should I change/set culture info settings in my WPF app and why? (Must works on all .NET frameworks 4.0 and newer)

  29. 29

    Set default application by extension not mimetype

HotTag

Archive