PDA

View Full Version : How to localize a plist file?




Nekbeth
May 4, 2011, 02:32 PM
Hi, I'm working on localizing my App. I have successfully localize my nibs but I'm having some trouble with plist. what is the best practice to localize them? using strings? or doing it the same way as a nib or image? Does every file I localize must be in the same language specific folder?


Please let me know if you need more specific info.

Thank you



Sydde
May 4, 2011, 04:07 PM
Hi, I'm working on localizing my App. I have successfully localize my nibs but I'm having some trouble with plist. what is the best practice to localize them? using strings? or doing it the same way as a nib or image? Does every file I localize must be in the same language specific folder?
Think of your keys as private (internal to your program). If people who speak your language can understand your keys and what the names mean, fine, but do not use "localized" plist keys. Only the content (objects referred to by the keys) should be localized. Arrange your plist files in such a way that localization will not affect anything but the content referred to by the keys.

PhoneyDeveloper
May 4, 2011, 04:39 PM
It is rude to cross-post the same question to multiple forums. You should allow 24 hours to pass if you post a question and it remains unanswered before posting somewhere else. You've only waited three hours this time since you posted at this question at the Apple forum.

webznz
May 4, 2011, 05:29 PM
24 hours is ridiculous.

PhoneyDeveloper
May 4, 2011, 05:39 PM
24 hours is ridiculous.

Seriously? But 3 hours or less is OK?

IMO, cross-posting of questions is abusive. Assuming that people must answer your questions immediately is rude. The questions posted to programming forums are not urgent like "What is the number for the hospital? I think I'm having a heart attack." Just wait a little while.

People who answer questions here take time and expend effort to do so and should not be abused.

Learning to program on iOS is not a matter of spamming the forums with questions. That's not how to learn.

Nekbeth
May 4, 2011, 05:59 PM
:D you are following every comment I post in the internet Phoney, don't you have something better to do with your time? I understand you don't want to help me but you could at least ignore my threads and let someone else help out.

EDIT:

Great !!, I figured it out.

If your a beginner, this is what you can do.

1 - Create 2 plist files, one for each language.

2- Look for your code and find where you use your plist, then you only have to change the string to this :NSLocalizedString(@"en.plist",@"") In my case it was inside a delegate, I needed to turn my plist into a dictionary like this:

NSString *Path2 = [[NSBundle mainBundle] bundlePath];
NSString *DataPath2 = [Path2 stringByAppendingPathComponent:NSLocalizedString(@"en.plist",@"")];

NSDictionary *tempDict2 = [[NSDictionary alloc] initWithContentsOfFile:DataPath2];
self.data = tempDict2;
[tempDict2 release];


3- Create two string files and name them as you like (e.g. en.strings and it.strings)

4 - Inside the en.strings type this :
"en.plist" = "en.plist"; // For English

and inside the it.strings type:
"it.plist" = "it.plist"; // For Italian


Thats it. Sometimes you will need to clean up and reinstall the app. change the language and you'll see the results :p

PhoneyDeveloper
May 4, 2011, 06:37 PM
I'm sure I'm not following them all.

I'm only making one point. Cross-posting is rude. If you don't do it I won't complain about it.

"If you don't want to help me just don't ..."

"Please don't reply to my threads in the future" etc.

"Just give me teh codes"

blah blah blah

Nekbeth
May 4, 2011, 06:59 PM
Well, then Im sure I'll be seeing you around me a lot :), because I get a lot of my answers that way. I actually pay to Apple to have access to its Forum, so I'm very much entitle to ask questions there and in any other forums.

PhoneyDeveloper
May 4, 2011, 07:04 PM
Yes, you're entitled to ask questions. Like everyone else. I assume you realize that we all pay to access that forum.

Just ask your questions and wait for the answers. Like everyone else.

RonC
May 4, 2011, 08:21 PM
... so I'm very much entitle to ask questions there and in any other forums.

Yes, you are, and we're very much entitle[sic] to not answer them.

There is an implicit social contract of behavior that is expected here. If you don't follow the rules, the community will shun you. Phoney is generally a very helpful resource, so please don't antagonize him.

Nekbeth
May 4, 2011, 08:40 PM
Yes, you are, and we're very much entitle[sic] to not answer them.

There is an implicit social contract of behavior that is expected here. If you don't follow the rules, the community will shun you. Phoney is generally a very helpful resource, so please don't antagonize him.

You can answer or not Ron, not saying you have to answer it. Phoney is just upset because I usually get my answers in 1 day or less while others get it in months or spend a lot $$ to get it done. Phoney might be D Master of iOS but personally he's just trying to burn me with the community because I ask the same question in two forums, so if he's not helping me.. I really don't care if I antagonize him or not, I'm still going to get my answers from forums, books , videos or any other documentation.

I also think he doesn't give a damn if I ask the same question in other forums. I have seen his posts and he usually gives a hard time to newbies trying to discourage them. He just doesn't like to share he's precious knowledge to new developers. Fortunately, some others do enjoy sharing it and have the patience to do it. (voluntary)