The Differences between Locales and Languages

The Differences between Locales and Languages

  • Comments 5

In a recent change - while we were still known as Developer Division Sustained Engineering - I addressed a functional change that relied on locales instead of languages for MUI support. I see this mistake a lot in developer forums and so I wanted to address what the difference was between a locale and languages.

A locale represents regional settings, the kind of settings you configure in the Regional and Language Options control panel applet without a language pack installed, which you can get through the Volume Licensing Program or in certain MSDN Subscriptions for development. Platforms that currently support MUI are Windows 2000, Windows XP, and Windows 2003, as well as the upcoming Windows release codename "Longhorn". For those platforms that do no support MUI or that do not have a language pack installed, the Regional Options control panel will only display locale settings.

Locale settings control how numbers, dates, and times display for your region - which may be a country, or a portion of country or may not even honor country boundaries. They are independent of your language. Setting a thread's locale or changing your system locale will change how numbers, dates, and times are displayed for controls created on that thread or running on your system, respectively.

A language, on the other hand, is what we speak, read, and write. Language settings control in what language text appears independently of the locale settings.

Often developers will use the locale to set both regional and languages settings. In VBScript that only provides the GetLocale function, this can be a problem; but, other APIs and frameworks provide plenty of support for getting these settings independently.

If you're developing managed applications or libraries, I recommend that you read Developing World-Ready Applications in the .NET Framework SDK. For native code, read about the various National Language Support APIs like GetUserDefaultLCID and GetUserDefaultUILanguage that get the user's preferred locale ID (LCID) or language ID (LANGID). The GetUserDefaultUILanguage API is only supported on MUI-enabled systems, so it's a good idea to fall back to GetUserDefaultLangID, which gets the language of the installed OS.

For managed code you have the Thread.CurrentCulture and Thread.CurrentUICulture properties that set the locale or language for the specified thread, respectively. Setting CultureInfo.CurrentCulture and CultureInfo.CurrentUICulture is the same as setting the equivalent properties on Thread.CurrentThread. The ResourceManager that you can use to localize your application uses the CultureInfo.CurrentUICulture property to display localized text.

For more information I recommend the book that's required reading at Microsoft, Developing International Software, Second Edition. Other great titles are available as well for Windows, XML, Microsoft .NET, and more.

Leave a Comment
  • Please add 1 and 2 and type the answer here:
  • Post
  • Sounds complicated.

    All I want is to be able to read and view foreign languages on my PC. Is it that hard?
  • What's complicated? For display formats use locales. For text display and control layout (typically because of the length of translated text) use language settings.

    To view other languages on your machine you must, for Windows, Office, and other MUI apps, install a language pack as I spoke of in my entry. Other applications may localize in different ways. Managed applications, for example, will default to the user-preferred language and locale, but you can easily set the current language and locale using the features I spoke of in the blog.
  • well charging $$ for the API Kit?
    Currently MS supports arabic style languages(Farsi/persian,Urdu,Sindhi,punjabi etc) by using Arabic Unicode,is there any plan of suporting other languages in .NET or in OS?i dont like converting my languages in arabic style,i would rather prefer following characters (http://www.omniglot.com/writing/urdu.htm)

    -adnan
  • The API "kit" (SDK) is free of charge from http://msdn.microsoft.com/platformsdk, but the MUI language packs - which are all the localized resources for the Windows OS (and language packs are also available for Office and even MSN Messenger) - require you to be in the Volume Licensing program.

    .NET strings are Unicode internally, but you can use code pages when necessary. Read about the Encoding class at http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemTextEncodingClassTopic.asp, for example, for information about how to encode strings with a particular code page to a byte[] array.
  • PingBack from http://dev-tips.info/?p=938

Page 1 of 1 (5 items)