Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi All,
In my project , I have one from need to use with 3 languages (Japan,Chinese,English).
I'd like to chage controls( labels, button, tabControl) text autoconvert based on the current culture.Like google translator.
But I don't want to use Google API.I want to try with .NetFrameWork.
My framework version is 4.0 and window application.
Posted
Updated 6-Nov-12 13:41pm
v2
Comments
Sergey Alexandrovich Kryukov 6-Nov-12 10:45am    
It is called globalization and localization. How you use it, depends on your application type which you did not tag, so -- no more exact answer. You can automatically switch between cultures, during runtime or not, but of course you would need to prepare 3 sets of resources. The resources are developed and stored separately (satellite assemblies) and found/loaded by the system automatically when you switch the thread culture / UI thread culture.
--SA
Theingi Win 6-Nov-12 21:07pm    
Do you mean i need to save 3 sets of resources for different languges? Is it possible to auto translate language in .net?


Thanks for your comments.
Theingi
Sergey Alexandrovich Kryukov 6-Nov-12 21:26pm    
Yes, 3 sets of resources; one in the original project and two more in satellites.

Translation? Automatic? Are you serious? Did you ever saw automatic translation with any acceptable quality?

And it would not be "in .NET". It's just the project (see Google translate): dictionaries, grammar rules, engine, everything. If Microsoft stuffed such thins in .NET... I don't know, probably nobody would use the platform even if it existed...

Google translator... OK, it's useful, but for feeding its output to real production site? -- it's a joke. Yes, I saw auto-generated sites, through automatic translation, but... what can I say? there was always a good number of morons on the Web, but joining that flock... :-)

--SA
Theingi Win 6-Nov-12 22:25pm    
Thanks you so much SA.
Now i got it which is the better way for my project. I will use 3 sets of resources with manually translation. :)
Thanks Again!

Theingi
Sergey Alexandrovich Kryukov 7-Nov-12 0:25am    
You are welcome.
And if you tell me your application type or UI library to use (WPF? Forms? ASP.NET? Silverlight? Metro? what?) I'll be able to give you proper references and some important detail and answer your further questions...
--SA

The answer based on the discussion in the comments to the question:

Please see my past answers:
globalization/localization problem in winform .net[^],
globalization in winforms[^].

—SA
 
Share this answer
 
cboLanguage.SelectedValueChanged += new EventHandler(cboLanguage_SelectedValueChanged);

private void cboLanguage_SelectedValueChanged(object sender, EventArgs e)
{
clsConstants.iiLanguageID = Convert.ToInt32(cboLanguage.SelectedValue);
SetupLanguageInterface();
this.Refresh();
}

private void SetupLanguageInterface()
{
foreach (Control c in this.Controls)
{
string cName = c.Name;
DataSet dsLanguage = StoredProcedureDataControlAdmin.GetLanguageText(cName, clsConstants.cFormName, clsConstants.iiLanguageID);
clsDataControl.dtLanguage = dsLanguage.Tables[0];
if (clsDataControl.dtLanguage.Rows.Count > 0)
{
c.Text = dsLanguage.Tables[0].Rows[0][0].ToString();
}
}
DataSet dsrtl = StoredProcedureDataControlAdmin.GetLanguageRighttoleft(clsConstants.iiLanguageID);
clsDataControl.dtLanguage = dsrtl.Tables[0];
if (clsDataControl.dtLanguage.Rows.Count > 0)
{
clsConstants.cRighttoleft = dsrtl.Tables[0].Rows[0][0].ToString();
}

// Change screen Layout
if (clsConstants.cRighttoleft == "RTL")
{
this.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.RightToLeftLayout = true;
}
else
{
this.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.RightToLeftLayout = false;
}
}

hope this will help
 
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