Reputation: 1469
I have a WinForms application with base language English. I localized a form to German. Some words in German are way longer than their English equivalents so I needed to move some controls around on the German version of the form. The problem is when I move the English controls the German localization doesn't reflect the movement (obviously).
However some controls were mistakenly moved and I'd like to reset them, so their movements on the English form are reflected on the German form as well.
How can I reset the position and size (or all properties) of a single control on the German form so that the control will move on both language versions of the form when moved on the English form? Is there a way other than digging into the localized .resx file and deleting all property assignments of a control?
Upvotes: 6
Views: 3531
Reputation: 119
As @Larry said, not always the Form's resx files are updated when changes are made at design time. They became corrupt and sometimes we need to set the Localizable property to false and set to true again to fix this. But the most important is maintain the .Designer.cs file always open in the editor to assume the changes, because it isn't always updated if it's closed. Never set the Localizable property to false if you are working in a language other than the default, unless you want this be the new default.
Upvotes: 0
Reputation: 968
I'm the author of a localization product for Visual Studio developers (in the interest of full disclosure). Any property you delete from the localized ".resx" file, either in the Visual Studio forms designer or manually in the ".resx" file itself, will then cause the control to defer to the default language's value of that property again. There's no specific feature that handles this however. You need to do it yourself on a control-by-control basis. Note however that Visual Studio is flaky sometimes, and has various bugs, for this and other issues, so things don't always work even when you do remove them using the designer (last time I reviewed the situation). Unless it's been fixed by now (I doubt it), if you set the "Location" property of a German control back to the default language's "Location" property for instance (in the designer), VS should remove the "Location" property from the ".de.resx" file. And it does - sometimes. Other times it doesn't (go figure) and you need to manually remove it yourself. Once it's gone though, the "fallback" process ensures that the default language property will then be used again (so moving the control on the English version in your case will move it on the German version, since both are then relying the same property again - the one from the English ".resx" file).
Upvotes: 6
Reputation: 9
Modern localization tools can help. Forms are presented visually in the tools allowing size and location values to be edited (if these have been set explicitly). Auto-size controls will be shown, but size/location won't be editable.
It is important to design your software with localization in mind. Avoiding changing forms significantly at runtime; avoid hard coded and concatenated strings, etc.
A localization tool will inspect your source code or compiled binary. It will spot the forms, strings, menus etc. to be translated. It will present those to a linguist for translation and give you back translated source code or binaries (depending on what you started with). The tools understand .net naming conventions for language folders, etc.
Search for ".net software localization" to find useful tools that can do the job.
Upvotes: 0
Reputation: 4593
I think that it would make your future development easier if you created your UI in a way that controls wouldn't need to be changed. Then you could just translate the labels and not mess with control positions.
For example put the labels on top of the corresponding edit fields, not left, make the buttons big enough to handle all texts. And consider rewording German texts to get them with smaller size.
Upvotes: 2