Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-20-2012, 12:54 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 84
prathibha is on a distinguished road
Thumbs up change the language in iphone

HI,

i want the different language to add in my project, so i created localization string for 2 language called el and fr
Its fine i created, now i add the code like this

NSString *path;
NSString *key = @"Welcome to Advance Localization"; // this i the string that is to be changed in every languages
path = [[NSBundle mainBundle] pathForResource:@"fr" ofType:@"lproj"];

NSBundle* languageBundle = [NSBundle bundleWithPathath];
NSString* str=[languageBundle localizedStringForKey:key value:@"" table:nil];

NSLog(@"locale is %@ %@",path,str);// here it is displaying the ke yvalue only not the changes language value..

Please can anyone help me in this please ...

i had a string called
prathibha is offline   Reply With Quote
Old 01-20-2012, 01:10 AM   #2 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

You should use NSLocalizedString.
Code:
NSString *str = NSLocalizedString(key, @"A comment about the string for later reference.");
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 01-20-2012, 01:17 AM   #3 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 84
prathibha is on a distinguished road
Thumbs up

Quote:
Originally Posted by Domele View Post
You should use NSLocalizedString.
Code:
NSString *str = NSLocalizedString(key, @"A comment about the string for later reference.");
thanks for the immediate reply , i added ur code but still it is coming the key value only. please help me? any mistake i did or any thing i missed?
prathibha is offline   Reply With Quote
Old 01-20-2012, 01:19 AM   #4 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

What do you mean by the key value only? And what are you trying to accomplish? I reread your post and I actually don't understand what you are trying to do.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 01-20-2012, 01:38 AM   #5 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 84
prathibha is on a distinguished road
Thumbs up

Quote:
Originally Posted by Domele View Post
What do you mean by the key value only? And what are you trying to accomplish? I reread your post and I actually don't understand what you are trying to do.
see, i want to change he value(meaning if i have submit value, then that submit should display in 2 language according to the the language display). . .

so i created the strings files and added the below string
""Welcome to Advance Localization" = "Bienvenue à l'avance la localisation"; for french

now i add the following code in viewdidload
NSString *path;
NSString *key = @"Welcome to Advance Localization";
path = [[NSBundle mainBundle] pathForResource:@"fr" ofType:@"lproj"];

NSBundle* languageBundle = [NSBundle bundleWithPathath];
// NSString* str=[languageBundle localizedStringForKey:key value:@"" table:nil];


NSString *str = NSLocalizedString(key, @"A comment about the string for later reference.");

NSLog(@"locale is %@ %@",path,str); now i want to display this "Bienvenue à l'avance la localisation" instead of "Welcome to Advance Localization" because i choosen fr...
prathibha is offline   Reply With Quote
Old 01-20-2012, 01:49 AM   #6 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

What does the NSLog output?
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 01-20-2012, 03:09 AM   #7 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 84
prathibha is on a distinguished road
Thumbs up

Quote:
Originally Posted by Domele View Post
What does the NSLog output?
the out put is the value of key? if u assign key as "hello" it will print hello only
prathibha is offline   Reply With Quote
Old 01-20-2012, 04:56 PM   #8 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

The simulator or device, whatever you are testing on, is the language set to French?
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 01-23-2012, 12:47 AM   #9 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 84
prathibha is on a distinguished road
Thumbs up

Quote:
Originally Posted by Domele View Post
The simulator or device, whatever you are testing on, is the language set to French?
yes that has been set to french only, but still its not changing the language?
prathibha is offline   Reply With Quote
Reply

Bookmarks

Tags
iphone, language, objective c

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 407
11 members and 396 guests
7twenty7, Atatator, FrankWeller, glenn_sayers, guusleijsten, iphonedevshani, MAMN84, QuantumDoja, Sami Gh, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,674
Threads: 94,122
Posts: 402,907
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Atatator
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:45 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0