Best way to implement a multilingual ASP.NET application

In a multilingual application, the following things / behavior are expected:

  • Get the right resources for registered users.
  • Sorting strings should be in accordance with the user's language (for example: in the case of Swedish users, the Swedish alphabets should appear after z in order).
  • Validation of the date format must be performed in accordance with the language of users. (For example: fr-FR users can enter dd / mm / yyyy, and US users can enter mm / dd / yyyy)
  • Repetition of the decimal validation should occur in accordance with the language of users (for example: 12.5 is valid in French, while 12.5 is not valid)

Now the question is how best to deal with this.

Approach 1:

  • Set the page culture and UICulture page so that the App_GlobalResources files are matched and the decimal values ​​in the grid are formatted correctly.
  • Write your own validation methods for the following
    • Datetime
    • Decimal
  • Create your own string sorting processing method.

Approach 2:

  • Set the current thread culture and let it handle the following {Does every web application user have an established culture in this case?}

Approach 3:

  • Initialize the globalization attribute in web.config and allow the application selection culture based on the user's browser culture

    <globalization uiculture="auto" culture="auto" enableClientBasedCulture ="true"/> 

Please let me know if there are better alternatives and how we should approach the solution of such problems or the pros and cons of the above approaches.

+4
source share
1 answer

Unload the InitializeCulture () event. Use a var session based on an authorized user that saves the currently selected culture and reset both Thread.Culture and UICulture in an event handler.

As far as I know, these conversion problems or ToString () format problems should not exist. The current thread culture will handle everything for you.

Some resources:
Walkthrough: Using Resources for Localization Using ASP.NET
How to customize the culture and culture of the user interface for globalizing an ASP.NET web page

+2
source

All Articles