C# .NET - C# support all languages in application based on user

Asked By Sahil Kumar on 26-Jun-11 09:11 AM

Hi All,


I have created an application but I need it to support all languages.   Completely multilingual.


For example : a spanish user buy my application and run on his machine it should detect current selected langauge on machine and when ever user type anything in application it should be visible in same langauge say spanish here.

Thread.CurrentThread.CurrentCulture.Name will give me current used language.


But how can I will show the typed information by user in same langauage in my application.


Actually it’s a keylogger application which will record keys. Now how can I

record keys in all langauges based on machine settings.


here I can not create resource file for each language so I have to use concept of windows.


Like selected language from windows and keyboard format of that language.


Thanks

Jitendra Faye replied to Sahil Kumar on 26-Jun-11 10:10 AM
For that you have to implement concept of Globalization in your application.

Globalization is the process of designing and developing a software product that function for multiple cultures. A web forms page have two culture values ,Culture and UICulture. Culture is used to determine culture dependent function such as Date, Currency. So it is used for date formatting ,number formatting. UICulture values is used to determine which language the resources should load that is which UIstring the resource should use. The two culture settings do not need to have same values. It may be different depending on the application.

Setting Culture and UICulture

1. Through Web.Config

<configuration>
<
system.web>
<
globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" uiCulture="fr-FR"/>
</
system.web>
</
configuration>


2. In Code-inline (aspx) Page

<%@ Page UICulture="fr" Culture="en-US" ....%>

3. In Code-Behind (aspx.cs) Page


Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture ("fr-FR");
Thread.CurrentThread.CurrentUICulture=
new CultureInfo("fr-FR");


ASP.NET wont automatically translate the contents in one language to another language by using Culture. For this we need to put strings in resources file and have to load the strings based on the culture.

For more detail follow these links-

http://www.codeproject.com/Kb/aspnet/localizationByVivekTakur.aspx
http://www.aspnettutorials.com/tutorials/controls/globalization-calendar-csharp.aspx

Hope this will help yopu.

Sahil Kumar replied to Jitendra Faye on 26-Jun-11 11:01 AM
1) Its desktop application not web.
2) Creating resource file in not possible for all languages.
3) Now when user press a, so in textbox it will show some character how can I use that in my application.

Think and answer. Analyse the problem dont just answer anything.