1

Currently the way I store strings is by using Localizable.strings, for example

English:

"URL" = "http://google.com";

Spanish:

"URL" = "http://google.com";

As you can see I have the same string for both languages, is there a way I can use something similar to localizable.strings (loads automatically, compatible with any language/localization) without having to write the same key/value in both files? And then retrieve the value using a method? ( NSGetstring("URL") )

feco
  • 4,384
  • 5
  • 27
  • 44
  • http://stackoverflow.com/questions/1669645/how-to-force-nslocalizedstring-to-use-a-specific-language - this may help you? – itsaboutcode Mar 21 '12 at 00:24

1 Answers1

2

Perhaps you can store the key/value pairs in a plist and read that into your code. Like this:

NSString *path = [[NSBundle mainBundle] bundlePath];
NSString *finalPath = [path stringByAppendingPathComponent:@"myList.plist"];
plistDictionary = [[NSDictionary dictionaryWithContentsOfFile:finalPath] retain];

Just store your information in the plist, then access it like you would any other dicitonary item:

NSLog(@"URL: %@", [plistDictionary objectForKey:@"URL"]);
Patrick T Nelson
  • 1,234
  • 12
  • 21
  • Yea.. but is there a way I can do it automatically without having to specify the path and storing it in a dict? – feco Mar 20 '12 at 23:17
  • The only way I can think of doing it without specifying a path is to use the NSUserDefaults, but that'd still require a dict :P – Patrick T Nelson Mar 20 '12 at 23:20
  • ok thx, I will leave the question open, maybe others may have an alternative :S – feco Mar 20 '12 at 23:26