Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Localization is always a huge amount of work, especially if you need to localize already created application.</p> <p>As for static labels of forms, there is an elegant solution which allows you to make 75% of work easily and quickly. Just move labels to resources, not touching your existing English labels. Then, depending on your current thread's Culture, change labels on the form reading them from localized resources.</p> <p>For instance, french resource for YourForm class:</p> <p>YourForm.fr-CA.resx:</p> <pre><code>"name" -&gt; "value" labelCaption\ --&gt; "Légende" labelInputLabel\ --&gt; "Champ de saisie" </code></pre> <p>"Name" is the name of your control object of the form, "value" is a label of the control.</p> <p>1). Make a base class for all your forms, for instance LocalizationBaseForm 2). Handle OnLoad() event in this class and read the resource. Depends on currently selected culture you will read corresponding localized resource. Canadian French will be located in /fr-Ca/ directory, Spanish in /es-Es/ etc.</p> <pre><code>ResourceManager manager = new ResourceManager(your_ form_type); ResourceSet set = manager.GetResourceSet(manager, ...); </code></pre> <p>3). Iterate through the list of labels and change labels on the form according the list on the resource.</p> <pre><code>//*pseudocode:* foreach (DictionaryEntry entry in set) { SetControlLabel(entry.Key, entry.Value) } </code></pre> <p>SetControlLabel(...) method looks a control with the given name and change it caption with the given new cation.</p> <p>You can make more complicated things, like localizing columns in grids, making values in resource more complex, for instance:</p> <p>"name" -> "value" gridTable(ColumnKey1)\ --> "Сolonne Une" gridTable(ColumnKey2)\ --> "Сolonne Deux"</p> <p>The same thing with trees, toolbars etc. You can even generate resource automatically, it's all up to you.</p> <p>That approach won't resolve all your problems, but it will help you if you need to localize your already existing application quickly. You still need to localize string parsers, dates etc.</p> <p>Good luck!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload