Jump to content
  • Advertisement
Sign in to follow this  
KazenoZ

Getting info of the current localized language used on a form

This topic is 2557 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

A little bit of mess on the title, I know, sorry about that =\

Anyway, I'm now going through the localization process of my program, but some parts of the program need to read the text on the controls and act according to the value there in English.
Not wanting to write each part of code that does that over again, I'm going with a method that translates everything to English when one of such parts is coming up, and translating back to the user-chosen language once that part of the code is done(Visually, the user should not notice the change).

Now, I already made the code, and it works, but I was just wondering if there is a way I can detect which language is currently in use that I could compare against my CultureInfo for the chosen language and determine whether or not to run the translation code at all if they're the same language, to save the process of translating when it's unneccessary.

Is there any property in the form that lets you access that information? MSDN didn't really provide me any help, and I can't seem to choose my keywording correctly for any useful Google searches.

Any help would very much be appreciated.


Also, just another little question, that I'm not sure if is possible be would help me immensely if anyone can tell me anything about it;
In conjunction with the above issue, the way I want to translate the form before and after every part of the code that needs to is at the beginning of end of alot of the Event Handlers, my question is; Is it possible to use an Event Handler that detects before and after another Event Handler is called and automate that process instead of having to add a line of code requesting translation at the beginning and end of every Event I use?

Thanks alot for the answers!

Share this post


Link to post
Share on other sites
Advertisement
Assuming one of the .NET languages, you can use CultureInfo.CurrentCulture or Thread.CurrentCulture to detect the current culture, though you may want to use CurrentUICulture instead.

Share this post


Link to post
Share on other sites
The problem is that I can't call this method without initializing a CultureInfo first, and a CultureInfo initialization requires the input of a language to initialize to, so it'll just give me the language I already have if I call the function after that.

Or am I missing something?

Share this post


Link to post
Share on other sites
Hmm... You're right... Weird, it didn't work when I did it a half hour ago. Must have typed something wrong and not noticed it.
Thanks alot!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!