Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
hi all! I am making Multilingual typing tutor and want to change input language from code, but the languages are NOT on the language bar (they are installed in the OS but i only have English showing in language bar) I tried the following code but it didn't work..
C#
System.Globalization.CultureInfo my_culture = new System.Globalization.CultureInfo("fr-FR");
InputLanguage c = InputLanguage.FromCulture(my_culture);
InputLanguage.CurrentInputLanguage = c;

Note that I do not want the end-user to first get those languages in language bar and then work.. In this case, I want to type in french but I'm unable to do so.. Please help me friends!
Posted
Updated 6-Nov-13 7:09am
v2
Comments
Ali Agha 6-Nov-13 14:43pm    
Thanks Sergey for reply.. So culture is just for UI, but i've actually read in different forums and also tested that the above code i posted works when the language is showing in "language bar".. Anyways, plz guide me how to input any type of data with unicode? do i need "toASCII" function ?? Im sorry, but im a beginner :)
Kschuler 6-Nov-13 15:12pm    
You need to reply to his solution, he won't get notification of this message otherwise.

It has nothing to do with input languages. The input language should be chosen by the user and only by the user. This is done by International Settings Control Panel applet in the system. The user can add one or more languages and define the way they are toggles. There is also such thing as "Input method", something of particular importance for cultures with too many characters or multiple writing system, like in Japanese.

For a background: do you understand that this Windows approach (and also the approach of nearly all modern OS) is perfectly correct? With Unicode, the user can enter data in any language, no matter what is the culture of application. The culture is primarily used to present UI in certain language (read about satellite assemblies related to this topic), to represent different formats for date/time, factional numbers and so on. If you switch from English to French, what should prevent me from writing data in Cyrillic on both cases? Nothing. These things are unrelated and should be unrelated. (Unless you aim to screw up user's work completely :-).)

—SA
 
Share this answer
 
v2
I think what you are missing is setting the Culture of the current Thread:
System.Threading.Thread.CurrentThread.CurrentCulture = my_culture;
Check out Felipe Vaz' blog entry "Localizable forms in C# or How to translate your C# application in the right way:" [^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900