Skip to content

Multi Lingual C# application - Issue on getting Chinese Lang

JOHNSON ANTONY

Asked Jan 23, 2015, 5:24 PM EST2 answers
Share
LinkedInX

Hi

I am developing a c# Winforms application using VS 2008 and DevExpress.

In one form, I need the some data to be added both in English and Chinese Language. So I placed separate textboxes for both Chinese and English and two buttons on form. one Button click shows Chinese language section and changes Inputlanguage . Second button hides Chinese language section, Changes InputLanguage .

When I run the application, First time when I change to Chinese Language, I am getting Chinese language selection option on typing English letter combination. But after returning to English, if I again go to Chinese data entry, I am not getting Chinese Language support on typing English.

But I am seeing the Language change on Taskbar.

Language Change Code

1st method
 
C#
 foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages) 
{
 CName = lang.Culture.EnglishName.ToString(); 
 if (CName.StartsWith("Chinese")) //"English" 
   { 
      InputLanguage.CurrentInputLanguage = lang; 
      break; 
   }
 }

2nd Method
Thread.CurrentThread.CurrentCulture = new CultureInfo("zh-CN"); 
Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-CN");

I tried this with normal windows forms  project and controls( Not Devexpress form) still the issue not solved. 

If we change input language manually at Taskbar, I am getting Language  selection option. The Issue is only 

with language  change from code.
Please give me a immediate advice 
Thanks Johnson

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    My advice to you is to:
    1. Read the standard documentation, which clearly states that ...CurrentCulture = new CultureInfo(...) "is a per-thread setting that determines the default formats for dates, times, currency, and numbers, the sorting order of text, string comparisons, and casing. The CurrentCulture property is not a language setting." (https://technet.microsoft.com/en-us/subscriptions/se513yha%28VS.71%29.aspx)
    2. Find as much documentation as you can and try the examples they provide before posting half-baked code and asking for immediate advice.
    3. Read this article, because it provides the information you seek: "How to Localize Windows Forms and Change the Language at Runtime"  http://www.dotnetcurry.com/showarticle.aspx?ID=174
    0
  • 0
    Hi clairestreb, Here language is changing always but not getting Language assistance on typing English letters from 2nd time onwards. But I am getting this on First time. Some expert people are saying it's something related to OS. I hope, you understand the Issue now
    0