KB Article T715347
Visible to All Users

Localization - How to avoid issues when localizing DevExpress WinForms components using the standard WinForms localization mechanism

Description:
I use the standard WinForms localization mechanism to localize my application. I followed the steps from your How to localize a WinForms application KB Article, however, I have difficulties related to localizing forms that contain some of your components (ButtonEdit, LookUpEdit). Do you have any ideas about why these issues may occur and how can I resolve them?

Answer:
We were reported about the number of issues related to our WinForms component localization using the standard Microsoft localization mechanism described in the How to localize a WinForms application KB Article. Although most of these issues are not directly related to our components and can be reproduced with the standard components as well, we've put great effort into their research to find ways to correct them. We resolved some issues at the level of our components.  We would be happy to resolve all of them on our side and already spent much time on this, but we could not find a reliable solution or way to fix certain issues without introducing breaking changes or side effects. Finally, we decided to collect known issues and reflect them in this article. Here you will see our experience with known issues and limitations related to localization and possible ways to resolve them.

Components and classes affected by localization
Our research revealed that issues may occur when the following classes are used:
1. GridColumnSummaryItem - issues may occur when you modify summaries (their order or properties) on a localized form. The simplest way to avoid them is to create summaries in code. Please refer to the Summaries and Working with Summaries in Code. Custom Summaries help articles for additional information.
2. ImageListBoxItemLookUpColumnInfo - issues may occur when you modify these objects' or controls' properties on a localized form. There are two possible workarounds:
- create these objects in code
- replace the controls with GridLookUpEdit where such issues don't take place

Components with a collection of localizable objects
We also found that Visual Studio doesn't automatically update all resx  files. As a result, issues may occur when you localize your project where components with a collection of localizable objects (such as ButtonEditLookUpEditGridView, etc.) are used. If you localize such forms, an error can be raised in the designer on an attempt to launch your application. This behavior is not related to our components and is caused by Visual Studio specifics. It can be reproduced with any component that has a collection of objects/elements. Please refer to the VisualStudio doesn't update all the localizable Form's resx files when localizable properties are changedMicrosoft issue.

The first workaround
A possible way to overcome this issue is to disable the Optimized Code Generation option in Visual Studio:

The second workaround
Since the issue occurs if you modify a button collection or customize buttons after a form was localized, we recommend you customize your form first and localize it after you finished layout customizations.

Other approaches to localize your application and correctly update RESX files
Another way to resolve the issue is to use the so-called "Master" resx file. The main idea is to set the form's Localizable property to True  and then modify all localizable properties according to your needs. In this case, Visual Studio automatically adds your changes to the default resx file. Then, change the form's Language property, for instance, to the German language and force VS to generate a new de.resx file. After that, open the default resx file, copy all its content to the de.resx file, and set localizable property values in that file. Please review the attached video to see this approach in action.

One more possible solution to localize your application is to use a 3d party tool, which provides access to all ResX-based string resources in your solution. For instance, you can use the ResXResourceManagertool.

Below is the list of related issues we researched.
ButtonEdit - An image assigned to a button is lost when a form's language is changed to Default (FIXED)
LookUpEdit - The FieldName property of LookUpColumns is marked as localizable
Lost designer code if localized button image is changed in the control
Invalid cast exception depending on languages
An editor name isn't updated in the Localization file when a localizable property of the Properties object (RepositoryItem) is changed

If the information from this article or an update to a newer version doesn't help, please create a new ticket with a detailed description and/or a sample project where the issue is reproducible. We will do our best to research your case and provide the most suitable solution.

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.