Localization and form size [modified]
-
Hi! I've localized my application to languages like English_US,Chinese_Simplified,Chinese_Traditional,Thai,Greek,Spanish,Japanese. I've added these languages to a list box. I've get currently selected from the list and uses it to get the culture info. I've also set different font's for the form according to the list selection(Why because languages like Chines,Japanese and Korean were not displayed with out the corresponding font). Here's the code:
switch(listIndex)
{
case 0:
cultureCode = "en-US"; //Culture code for English US
this->Font = System::Drawing::Font(L"Microsoft Sans Serif",8);
break;
case 1:
cultureCode = "zh-CN"; //Culture code for Chinese_Simplified
this->Font = System::Drawing::Font(L"Simsun",8);
break;
case 2:
cultureCode = "fr-FR" //Culture code for French
this->Font = System::Drawing::Font(L"Verdana",8);
break;
default:
}
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("cultureCode");
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;My problem is: (i) size of my form shrinks when I select any language other than English. This doesn't happen always. If I set the font through code as above, the size of the form shrinks. If I didn't set the font through code, Chinese,Japanese and Korean languages can't be displayed. What to do to display these languages as well as to keep the form size constant? (ii) Which font is required to display Korean language?
modified on Thursday, March 31, 2011 1:19 PM
-
Hi! I've localized my application to languages like English_US,Chinese_Simplified,Chinese_Traditional,Thai,Greek,Spanish,Japanese. I've added these languages to a list box. I've get currently selected from the list and uses it to get the culture info. I've also set different font's for the form according to the list selection(Why because languages like Chines,Japanese and Korean were not displayed with out the corresponding font). Here's the code:
switch(listIndex)
{
case 0:
cultureCode = "en-US"; //Culture code for English US
this->Font = System::Drawing::Font(L"Microsoft Sans Serif",8);
break;
case 1:
cultureCode = "zh-CN"; //Culture code for Chinese_Simplified
this->Font = System::Drawing::Font(L"Simsun",8);
break;
case 2:
cultureCode = "fr-FR" //Culture code for French
this->Font = System::Drawing::Font(L"Verdana",8);
break;
default:
}
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("cultureCode");
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;My problem is: (i) size of my form shrinks when I select any language other than English. This doesn't happen always. If I set the font through code as above, the size of the form shrinks. If I didn't set the font through code, Chinese,Japanese and Korean languages can't be displayed. What to do to display these languages as well as to keep the form size constant? (ii) Which font is required to display Korean language?
modified on Thursday, March 31, 2011 1:19 PM
A Windows form has the properties
AutoSize
andAutoSizeMode
. You can setAutoSize
tofalse
to prevent any size changes, orAutoSizeMode
toGrowOnly
to allow for a growing form. -
A Windows form has the properties
AutoSize
andAutoSizeMode
. You can setAutoSize
tofalse
to prevent any size changes, orAutoSizeMode
toGrowOnly
to allow for a growing form.Hi! Thanks for the reply. Setting the font is not enough to display Chinese Text over Title Bar of the form(Caption of the Form). Every language Text is displayed properly else where except the Caption of the Form. What to do to dispaly Chinese Text over the caption of the form?
-
Hi! I've localized my application to languages like English_US,Chinese_Simplified,Chinese_Traditional,Thai,Greek,Spanish,Japanese. I've added these languages to a list box. I've get currently selected from the list and uses it to get the culture info. I've also set different font's for the form according to the list selection(Why because languages like Chines,Japanese and Korean were not displayed with out the corresponding font). Here's the code:
switch(listIndex)
{
case 0:
cultureCode = "en-US"; //Culture code for English US
this->Font = System::Drawing::Font(L"Microsoft Sans Serif",8);
break;
case 1:
cultureCode = "zh-CN"; //Culture code for Chinese_Simplified
this->Font = System::Drawing::Font(L"Simsun",8);
break;
case 2:
cultureCode = "fr-FR" //Culture code for French
this->Font = System::Drawing::Font(L"Verdana",8);
break;
default:
}
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("cultureCode");
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;My problem is: (i) size of my form shrinks when I select any language other than English. This doesn't happen always. If I set the font through code as above, the size of the form shrinks. If I didn't set the font through code, Chinese,Japanese and Korean languages can't be displayed. What to do to display these languages as well as to keep the form size constant? (ii) Which font is required to display Korean language?
modified on Thursday, March 31, 2011 1:19 PM
I've noticed one problem with the code snippet.
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("cultureCode");
Looks like it should be
System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(cultureCode);
Also the way I've handled globalisation is by using resource files and letting the system's culture determine which resource file to use. You might want to Read these MSDN articles
"You get that on the big jobs."