2012年12月26日 星期三

About National Language Support

The msdn document http://msdn.microsoft.com/en-us/library/dd317708(v=vs.85).aspx .


The National Language Support (NLS) functions permit applications to:
  • Set the locale for the user
  • Identify the language in which the user works
  • Retrieve strings representing times, dates, and other information formatted correctly for the specified language and locale

There is also the http://stackoverflow.com/questions/953416/find-out-the-language-windows-was-installed-as talk about this.  Two ways to get the OS installed language
1. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\Language\InstallLanguage which returns a four digit language code.
2. The Win32 function is GetSystemDefaultUILanguage() http://msdn.microsoft.com/en-us/library/dd318123(VS.85).aspx.

1. Locale IDs, Input Locales, and Language Collections for Windows XP and Windows Server 2003.
http://msdn.microsoft.com/en-us/goglobal/bb895996.aspx.  

2. Re: How to translate the LANGID into strings. http://www.tech-archive.net/Archive/VisualStudio/microsoft.public.vstudio.general/2004-08/0250.html

 TCHAR szName[100]; 
        if ( 0 != GetLocaleInfo( MAKELCID( MAKELANGID( 0x411, 0 ),
SORT_DEFAULT ),
                LOCALE_SENGLANGUAGE,
                szName, 100 ) )
        {
                printf( szName );
        } 




沒有留言:

張貼留言