how to change culture

  • Thread starter Thread starter ChunkyMonkey
  • Start date Start date
C

ChunkyMonkey

Hi,

I am playing with an application that needs to be able to be multi
langauge..

So far I have been able to localise my forms, but I am stuck at how to test.

I can see that you can change the culture of the application using
My.Application.ChangeUICulture("de") for example.

I have figured this code needs to go somewhere special as it has no effect
in the form_load event...

Where should this line go, or am I doing something wrong totally...

Thanks
 
Be aware that changing cultures in a program is a bad habit.

Your Net program is build around what the user selects.

If you do that yourself you probably will soon have users which complaints
that your program has bugs.

The culture exist by the way in the used language and the culture "de-DE",
while beside the culture for the UI there is also a general culture setting.

Cor
 
How very typical of you, Cor - instead of answering the OP's question you
only question why the OP wants to do what he is asking. Why not just answer
the question and let the OP worry about any possible complications? It is
not up to the rest of us to play moral guardians. Most programmers acutally
think about the consequences of what they want to do and only wants a reply
to "How do I do it?"

' Changes the CurrentCulture of the current thread to th-TH.
Thread.CurrentThread.CurrentCulture = New CultureInfo("th-TH", False)

' Changes the CurrentUICulture of the current thread to ja-JP.
Thread.CurrentThread.CurrentUICulture = New CultureInfo("ja-JP", False)

You will need to:
Imports System.Threading

and it could be that you have to adjust security permissions also... More
info:
http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.currentculture.aspx

Best regards,
Johnny J.
 
This is just for me to test that I am getting the multi langauge stuff
working (never done it before so not sure what I am doing and need to test
on my english pc)..

Once I know that it works, then I will be fine as I know if the user
installs the app on a german PC they get what they should...

I won't be giving the end user the ability to change this
 
Hi,

I have added the code

'Thread.CurrentThread.CurrentCulture = New
Globalization.CultureInfo("de-DE", False)'

as the first line in my form_load event.

In VS i have set the forms property to be localizable and then set the
language to German(Germany), and then changed some of the labels to be
german words.

Changing the language in vs designer works and the langauge of choice is
shown.

However when I run my code, even with the line above, I only ever see the
english version...

Testing further I also added in the line
Thread.CurrentThread.CurrentUICulture = New
Globalization.CultureInfo("de-DE", True)

After those two lines I checked the values via
MsgBox(Application.CurrentCulture.CurrentUICulture.ToString)
MsgBox(Application.CurrentCulture.CurrentCulture.ToString)


and both response de-DE.

Why am I still getting the english version, and what do I have to do to get
my german UI ???

Thanks
 
Johnny,

I see that you are the one who knows what most programmers even actually
think.

I would not be busy in that case in a newsgroup.

You can become rich man, there is for you no need to lurk a newsgroup, you
know it already.

But I don't know that, the only thing I know is that it is good for you to
visit an optician, what you were answering was already in the message of the
OP so I only added to that, so probably you need glasses.

I find it even brute to give to somebody my code style while he shows a good
one.
The OP showed that he was using this, why should he do it your way?

http://msdn.microsoft.com/en-us/library/486cdc73.aspx

He does not even to import threading for that.

But I think it is better now that you answer to his question to you, I am
very curious for your answer.

Cor
 
Hi Cor

I have taken another look at the code... and I can cut and paste into my
project, and have the date displayed in the relevent culturesettings, so it
works.

What does not work, is that my forms are always in english, even though I
have created the language version in VS.

What I want to see is that when I have the changeculture/changeUICulture in
my formload event, then the form is loaded with the relevent language.

What am I missing to get this to work ..... It should be simple

Thanks
 
Hi,

The culture is for setting the way date times, calendars, decimals and
currency symbols are used according to the language.

However, it is an aprox. English uses by instance in every country where
English is spoken a point a decimal separator (this is too in some Coca Cola
cultures), for the rest it is mostly an comma. But in the part of South
Africa where English is spoken, is the decimal separator as well a comma
like in other languages.

It is not about the language itself.

Cor
 
I see that you are the one who knows what most programmers even actually

I don't claim to be able to read anybodys mind, but I DO see that your reply
to the OP is not in any way an answer to what he wants to know - just an
irrelevant comment
I would not be busy in that case in a newsgroup.

As far as I know you're busy in the newsgroup because you're paid to be so,
right?
You can become rich man, there is for you no need to lurk a newsgroup, you
know it already.

What is your definition of lurk? I post a lot in this newsgroup, both
questions and responses to other peoples questions. And may I say - for the
record - that the times I have posted a question in this newsgroup and
gotten a response from you, it has always been the same kind of response you
give this OP: No help at all, just commenting on something entiry
irrelevant - AND doing so with an unpleasant attitude at that!
But I don't know that, the only thing I know is that it is good for you to
visit an optician, what you were answering was already in the message of
the OP so I only added to that, so probably you need glasses.

I find it even brute to give to somebody my code style while he shows a
good one.
The OP showed that he was using this, why should he do it your way?

http://msdn.microsoft.com/en-us/library/486cdc73.aspx

He does not even to import threading for that.

So what? - At least I was trying to help by trying to provide an answer that
could actually help solve the problem. I guess in order to get any help from
you, the first thing a person has to do is convince you it's actually what
he wants to do, because you seem to think every programming question is
either stupid or unnecessary.
But I think it is better now that you answer to his question to you, I am
very curious for your answer.

You're acting like a spoiled child Cor, but I had expected no less. Why
don't you instead have a look at the answer you posted and ask yourself:
"Was this answer of ANY help to the OP at all? Did it in any way help him
solve his problem?" Can you truthfully say yes to that?

Any way - why do I bother?

/Johnny J.
 
So I did not write this in my first reply on his question if it was "de"?
The culture exist by the way in the used language and the culture "de-DE",
while beside the culture for the UI there is also a general culture
setting.

Cor
 
Hi

OK, thanks I understand the use of the changeculture / changeuiculture now.

So how then do I get to test the multilangague interface in my applicaiton
which is what I have been always trying to achieve.

After setting the form to be localisation=true, and in VS creating langauge
versions of my forms (say in german and italian) how can I test this in on
my PC which is en-US
I want to run my application, set the language I want the application to be,
so that I can see that all my forms, in all different langauges look like it
should.

Sure there is away to test this without having to install on a version of
Vista in German/Italian....


Thanks all.
 
Back
Top