Neel
2006-03-08 14:53:22 UTC
Hi,
I am trying to change application locale dynamically, for that i
need to know the current culture/language of machine so that i can
switch application locale to the same language.
following is the snippet of code which return me the "en_IN". Please
have a look,
CFLocaleRef userLocaleRef = CFLocaleCopyCurrent();
CFStringRef l_CurrentLocale, l_CanStr;
l_CurrentLocale = CFLocaleGetIdentifier(userLocaleRef);
char buffer[255];
memset(buffer, '\0', sizeof(buffer));
l_CanStr =
CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorDefault,
l_CurrentLocale);
CFStringGetCString(l_CanStr, buffer, 255, CFStringGetSystemEncoding());
Alert(buffer);
// output is en_IN.
Now, if i change "System Preferences->International->Language" to other
language suppose "Chinese" then i would be expecting something like
"ch_ " as string output but it does not work, it shows always en_IN.
Why so ? Where should i make change to get the current language/culture
of the Macintosh OS X 10.3.5 dynamically ?
My application .plist looks like:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple
Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<array/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>0</key>
<string></string>
<key>CFBundleTypeName</key>
<string>Text file</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>TEXT</string>
</array>
<key>CFBundleTypeRole</key>
<string>Application</string>
</dict>
</array>
<key>CFBundleGetInfoString</key>
...........
Please suggest.
Thanks in advance.
Neel.
I am trying to change application locale dynamically, for that i
need to know the current culture/language of machine so that i can
switch application locale to the same language.
following is the snippet of code which return me the "en_IN". Please
have a look,
CFLocaleRef userLocaleRef = CFLocaleCopyCurrent();
CFStringRef l_CurrentLocale, l_CanStr;
l_CurrentLocale = CFLocaleGetIdentifier(userLocaleRef);
char buffer[255];
memset(buffer, '\0', sizeof(buffer));
l_CanStr =
CFLocaleCreateCanonicalLocaleIdentifierFromString(kCFAllocatorDefault,
l_CurrentLocale);
CFStringGetCString(l_CanStr, buffer, 255, CFStringGetSystemEncoding());
Alert(buffer);
// output is en_IN.
Now, if i change "System Preferences->International->Language" to other
language suppose "Chinese" then i would be expecting something like
"ch_ " as string output but it does not work, it shows always en_IN.
Why so ? Where should i make change to get the current language/culture
of the Macintosh OS X 10.3.5 dynamically ?
My application .plist looks like:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple
Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<array/>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>0</key>
<string></string>
<key>CFBundleTypeName</key>
<string>Text file</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>TEXT</string>
</array>
<key>CFBundleTypeRole</key>
<string>Application</string>
</dict>
</array>
<key>CFBundleGetInfoString</key>
...........
Please suggest.
Thanks in advance.
Neel.