How can I let the user choose a specific localization in my app? I have a book and I'd like the users to be able to read all the different translations of it.
+1
A:
You'll need to implement your own localisation methods.
One way to do this is to subclass NSBundle and override -pathForResource:ofType:inDirectory:forLocalization:
and -pathsForResourcesOfType:inDirectory:forLocalization:
. In your overrides, read from NSUserDefaults or whatever to decide which localisation to use then manually find the right one.
iKenndac
2009-10-30 15:43:32
What about strings? NSLocalizedString()
Dimitris
2009-10-30 16:55:34
NSLocalizedString is simply a macro that expands to -[NSBundle localizedStringForKey:value:table:] (Command+Double-click NSLocalizedString in Xcode to see the definition). I imagine this routes through -pathForResource:(etc) to find the strings file. If not, you'd have to override -[NSBundle localizedStringForKey:...] as well.
iKenndac
2009-10-30 17:31:17
Thanks for all that. But it sounds like too much hassle.. I'll try to find another way to do this and I'll let you know.
Dimitris
2009-10-30 17:46:01
I am sorry for not accepting your answer as correct, but I haven't had the time to try it our yet.
Dimitris
2009-11-19 00:32:16