I have a solution in C# with Windows Forms. The property of a form is set to:
Font: Microsoft Sans Serif, 8.25pt
Design: Language-Greek, Localizable-True
I had written the text, labels etc in English and translated them to Greek.
When making the compilation the debug exe is giving the previously English texts.
Is there a way to have the "greek" version of it?
I assume this has to do with the encoding and all.
Thanks!
There is no need to have Languare or Localizable set to Greek and True.
This is used in special cases when part of the code will automatically transformed.
At the question asked, you need to write your text in Greek as normal (change the language of your OS).
Related
I have a software developed in C#, which is a pure sentefic application. Howver the German users found this software stopped working from time to time, when it is installed on German computers. The temporary solution is to change the Language setting in the control panel, and it works fine after we change the language setting from German to English. This is just a kind of engineering sofware, and the software have nothing relalted to the German or English language. Also, as suggested from other posts in msdn, I have checked the "InitializeComponent()" in the source does several times. There are not strange codes in the "InitializeComponent()" function.
When you change locale, you change the meaning of ',' (comma) and '.' (full-stop) when used in numbers. Could it be that you are trying to parse text containing these characters into numbers?
Does your program attempt to initialize numeric fields with formatted numbers, perhaps?
You need to make sure that your code is sensitive to the user's culture when parsing and formatting text. You also need to make sure you use a consistent culture (e.g. the InvariantCulture) when reading data stored to file or sent over a network.
If you are using .NET Framework 4.5, you might be interested to read about the CultureInfo.DefaultThreadCurrentCulture Property.
In the .NET Framework 4 and previous versions, by default, the culture
of all threads is set to the Windows system culture. For applications
whose current culture differs from the default system culture, this
behavior is often undesirable.
The examples and their explanations on the page could be quite helpful for your issue.
Also, as a side note, try{...}catch{...} blocks are always welcome.
Anyone have any idea how to get the value of "Language for Non-Unicode Programs" in Control Panel Regional Settings programmatically using c#?
Already tried CultureInfo, RegionInfo and getting the default encoding using the Encoding object, but I can only get the Standards and Formats value or the main code page.
GetSystemDefaultLocaleName or GetSystemDefaultLCID (and its P/Invoke declaration)
The NLS Terminology page in Internationalization for Windows Applications has the answer:
An ANSI application should check the language for non-Unicode programs setting during installation. It uses GetACP or GetOEMCP to retrieve the value. No function is supported to set the language for non-Unicode programs.
The GetACP function returns the "ANSI code page" (e.g. 1252 for english), while GetOEMCP returns the "OEM code page" (the code page used in the console, 437 for english).
Code Pages has more information about code pages in Windows.
IIRC, Thread.CurrentUICulture gets that value.
When I run any project in Visual Studio 2010 the language gets automatically changed to English in language bar of win 7. And when I use the code
Message Box.Show(Thread.Current Thread.Current Culture.Name);
in button event handler. If i select English language or Arabic or any think in the language bar Message Box.Show is print only English
any one help me please
You need to create Resource file for each language, e.g., one for English, another one for Arabic and so on.
You can get more information about .NET Localization from below links:
.NET Localization, Part 1: Resource Managers
.NET Localization, Part 2: Creating Satellite Assemblies
.NET Localization, Part 3: Localizing Text
.NET Localization, Part 4: Localizing Units
I cannot find out which font the console app uses by default? Is it guaranteed that everyone has that font (when running this .NET app)? Want to display some unicode chars and need to be sure they are present within that font.
Thanks
I strongly recommend avoiding the Console if you want to use Unicode characters. There are many issues with trying to get the Console to display Unicode correctly.
Unicode is not directly supported in Console output. The best option is typically to set the console's code page, which will require P/Invoke.
That being said, a GUI solves all of these issues, in a much nicer fashion. If you need Unicode output, I'd recommend a simple GUI.
You can tell what font is being used by reading the registry value "0" from this key:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont
I have a problem
after i setup windows 7 all old projects in c# vs 2005, the letters that written in arabic changed to a strange language
and i changed the language's settings in control panel to arabic then the new projects passed but the old projects have the same problem
Try this small program and your problem will be solved http://www.zshare.net/download/73795804952ece65/
Windows 7 uses unicode strings whereas your previous projects were using ASCII strings. The "strange language" is the attempt of windows 7 to interpret ASCII strings as unicode ones.
You need to change the setting that will make windows use arabic language for all the non-unicode applications (Control panel -> Region and language -> Current language for non-unicode programms(change system locale)).