What is system.globalization And what's the difference between it and localization

后端 未结 3 1901
眼角桃花
眼角桃花 2021-01-02 18:45

and to spice things a bit , what is the best approach for globalization in Asp.net Mvc App

相关标签:
3条回答
  • 2021-01-02 19:21

    The System.Globalization namespace contains classes that define culture-related information, including the language, the country/region, the calendars in use, the format patterns for dates, currency, and numbers, and the sort order for strings.

    As for what's the difference between it and localization? I guess that can be explained as the difference between a car and a city. One is a destination and the other is how you get there.

    I haven't used ASP.NET MVC, but I have used Monorail which is similar. If I wanted to localize a MR app, I would probably use a separate tree of view files. So while, for english-only, I'd have:

    \Views\Home\*.asp
    \Views\Admin\*.asp
    \Views\Products\*.asp
    

    for an internationalized app, I'd have something like:

    \en\Views\Home\*.asp
    \en\Views\Admin\*.asp
    \en\Views\Products\*.asp
    \de\Views\Home\*.asp
    \de\Views\Admin\*.asp
    \de\Views\Products\*.asp
    \es\Views\Home\*.asp
    \es\Views\Admin\*.asp
    \es\Views\Products\*.asp
    
    0 讨论(0)
  • 2021-01-02 19:23

    Globalization is about producing a map from strings or identifiers to translations in other languages, while Localization is about using that map to find the correct translation. Globalization happens during development, localization happens at runtime.

    I'm not very experienced doing this with ASP.NET, but...

    As for how, the most common approach I see is to have a dictionary per language per assembly (or per UI component), where the values are localized strings. The keys are typically readonly members on a static class or enum. There is often a convenience class whose members are the map from identifiers to localized messages.

    The dictionaries are typically stored in separate files and in a format targeted to human translators.

    More here: http://msdn.microsoft.com/en-us/library/aa478974.aspx

    0 讨论(0)
  • 2021-01-02 19:26

    From the W3C I18n FAQ:

    Localization refers to the adaptation of a product, application or document content to meet the language, cultural and other requirements of a specific target market (a "locale").

    Internationalization (or globalization) is the design and development of a product, application or document content that enables easy localization for target audiences that vary in culture, region, or language.

    I've never globalized an ASP.NET MVC application, so sorry if I can't help you there.

    0 讨论(0)
提交回复
热议问题