The “Right” Way to Use Multilingual Support

I just started working with ASP.NET, and I'm trying to bring along some of the coding standards that I think are healthy. Among these standards, there is multilingual support and the use of resources to easily handle future changes.

Back when I used to encode desktop applications, every text had to be translated, so it was common practice to have language files for all languages ​​that I would like to offer my clients. In these files, I would display every text, starting with button labels and ending with error messages. In ASP.NET using Visual Studio, I have the opportunity to use the IDE to create such resource files (from Tools → Generate Local Resource), but then I will need to fill my web pages with shortcuts - at least this is what I learned from articles and manuals. However, this approach looks a little strange, and I am tempted to guess that it doesn't smell so good. Now to the question:

  • Should I store each text on my website as shortcuts and manage its contents in resource files? This looks strange, especially when looking at text with a few paragraphs.

  • Whenever I add / delete something, for example: a button, in an aspx file, I have to add it to the resource file, since the generation of the resource file again will just override all my previous changes, This is not like reusable code for me .

Perhaps I got everything wrong from the textbooks, since this does not seem to be a standardized question - especially if you need to recompile the entire application when you need to make some changes.

+4
source share
1 answer

Best practices for localizing ASP.NET Web Forms over the years have not changed much. If you don’t have much dynamic content, you can get away with implicit localization and attach web form controls (form elements and yes, even labels) to resource files. Explicit localization is useful if you want to have a little more control over where the localized text appears in a control with multiple headings or something that you created yourself. You do not have to go far in the instructional instructions from MS on how to do this.

Walkthrough: Using Resources for Localization Using ASP.NET

If your localization requirements are more dynamic, for example, you want to easily provide new languages, centralize resources, or you need to provide new string signatures for a new dimension (for example, for each client) , then you need to learn a little .. NET allows you to expand the resource provider, and you can implement a database backend that makes it easy to administer localized resources.

Extending the ASP.NET 2.0 Resource Provider Model, Creating a Database Resource Provider

Extending a provider resource to store resources in a database * Later implementation

Or you can just roll your own!

I also dug up a duplicate SO post. I’m several years old, but, based on experience, I believe that the recommendations found on the project page based on the reference code are still correct (for web forms): Globalization and localization are demystified in ASP.NET 2.0

I hope this helps! If you have more specific localization questions, add them to your questions or comments.

+8
source

All Articles