Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
swdev:dotnet:localization_using_resx_files [2011/07/14 15:59]
smayr [WinForms Localization]
swdev:dotnet:localization_using_resx_files [2013/12/16 15:26] (current)
smayr
Line 8: Line 8:
     * Set Access Modifier to ''Public'' (top toolbar in resource document).     * Set Access Modifier to ''Public'' (top toolbar in resource document).
     * Add strings to the Resource file. Eg: ''rsClose'' = ''Close''     * Add strings to the Resource file. Eg: ''rsClose'' = ''Close''
-  * Create other resources files for other languages. For example: +  * Autotranslate original English RESX strings using Google Translate and [[http://resxtranslatorbot.codeplex.com|Resx Translator Bot]]. 
 +  * Create other resources files for other languages not supported in autotranslation. For example: 
     * ''Resources.es.resx'' for Spanish (es-ES)     * ''Resources.es.resx'' for Spanish (es-ES)
     * ''Resources.fr.resx'' for French Canadian (fr-CA), or potentially ''Resources.fr-CA.resx'' as well.     * ''Resources.fr.resx'' for French Canadian (fr-CA), or potentially ''Resources.fr-CA.resx'' as well.
Line 49: Line 50:
 </code> </code>
  
-  * Localize controls. Modify ''frmMain.cs'' to include: <code csharp>+  * Localize controls. For example, using form ''frmMain'', modify file ''frmMain.cs'' to include: <code csharp>
 private void frmMain_Load(object sender, EventArgs e) private void frmMain_Load(object sender, EventArgs e)
 { {
Line 57: Line 58:
 private void LoadResources() private void LoadResources()
 { {
 +    // Optional method to load resources local to this form
     //System.Resources.ResourceManager resmgrlocal = new System.Resources.ResourceManager(     //System.Resources.ResourceManager resmgrlocal = new System.Resources.ResourceManager(
     //    "LocalizedAppWinForms.Properties.Resources",     //    "LocalizedAppWinForms.Properties.Resources",
Line 66: Line 68:
     //btnClose.Text     = resmgrlocal.GetString("rsClose");     //btnClose.Text     = resmgrlocal.GetString("rsClose");
  
 +    // Method to load global resources (defined in Program.cs file)
     lblFirstName.Text = Program.resmgr.GetString("rsFirstName");     lblFirstName.Text = Program.resmgr.GetString("rsFirstName");
     lblLastName.Text  = Program.resmgr.GetString("rsLastName");     lblLastName.Text  = Program.resmgr.GetString("rsLastName");
Line 747: Line 750:
 } }
 </code> </code>
 +
  
 = Reference Material = = Reference Material =
Line 754: Line 758:
   * [[http://www.codeproject.com/KB/WPF/WPF_Resx_Localization.aspx?display=Mobile&fid=1538725&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=101|WPF Localization Using ResX Files]]   * [[http://www.codeproject.com/KB/WPF/WPF_Resx_Localization.aspx?display=Mobile&fid=1538725&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=101|WPF Localization Using ResX Files]]
   * [[http://www.codeproject.com/KB/WPF/WPF_Localization.aspx|Simple WPF Localization]]   * [[http://www.codeproject.com/KB/WPF/WPF_Localization.aspx|Simple WPF Localization]]
 +  * [[swdev:dotnet:localization:Editing RESX Files with SimpleResxEditor]]