Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting Users default language?

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support
View previous topic :: View next topic  
Author Message
ap3000
Guest





PostPosted: Fri Oct 02, 2009 11:47 am    Post subject: Getting Users default language? Reply with quote

Maybe I don't get the concept right, but what I try to accomplish is that our app checks if the users default language is NL, so yes than use the invariant language(Netherlands) or if not - Then use the English translation.

But On my own machine it all ready went wrong.
I thought that I could use this to
Code:

            if (CultureInfo.CurrentUICulture.Name == "nl-NL")
            {
                CultureManager.UICulture = new CultureInfo("nl");
            }
            else
            {
                CultureManager.UICulture = new CultureInfo("en");
            }


But my OS is English and I have selected Dutch/Netherland as language/region and it doesn't matter witch language/region I set hi's always giving me the Dutch version. With other words the

Code:

CultureInfo.CurrentUICulture.Name

is always returning nl-NL.

Please shine some light for me here.
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Fri Oct 02, 2009 10:46 pm    Post subject: Reply with quote

The CultureInfo.CurrentUICulture property is set by default by the .NET framework to the culture of the OS. It isn't affected by the regional settings. So I would have expected if your OS UI is English then that would be the default value for CurrentUICulture.

The CultureInfo.CurrentCulture (and Thread.CurrentThread.CurrentCulture) property is set by default to the regional settings value. This means that if you want your application UI to be based (by default) on the regional settings selected then your code should execute the following before displaying any forms:

Code:
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;


If you are using the Infralution CultureManager component to support changing the culture of open forms dynamically then you should instead call:

Code:
CultureManager.ApplicationUICulture = Thread.CurrentThread.CurrentCulture;


The sample C# and VB Windows forms projects included in the Version 2 installation demonstrate how to do this.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Globalizer Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group