Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Mac > OOP Powerplant for Mac > How to change a...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 445 of 483
Post > Topic >>

How to change application locale dynamically according to current machine local language ?

by "Neel" <nilesh_ibmr@[EMAIL PROTECTED] > Mar 8, 2006 at 06:53 AM

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>CFBundleDo***entTypes</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.
 




 2 Posts in Topic:
How to change application locale dynamically according to curren
"Neel" <nile  2006-03-08 06:53:22 
Re: How to change application locale dynamically according to cu
"Neel" <nile  2006-03-09 21:03:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Thu Jul 24 2:16:10 CDT 2008.