Reputation: 8050
Is there a way to alter the localization strings after iOS reads them from Localizable.strings, and still maintain the ability use NSLocalizedStringWithDefaultValue(key, table, bundle, value, comment)
? In other words, is it possible to programmatically alter localized strings, say, after receiving an updated set of strings from a server?
This question assumes that Localizable.strings can't be modified because that would require modifying the main NSBundle, which is not allowed after an app is installed.
Upvotes: 1
Views: 127
Reputation: 10938
Redefine your NSLocalizedString
macros to whatever you want:
#undef NSLocalizedString
#define NSLocalizedString(key, comment) \
[MyLocalizationManager localizedStringForKey:key]
Upvotes: 0
Reputation: 8050
One way would be to create a new bundle containing your desired strings file and use that bundle instead of [NSBundle mainBundle]
in NSLocalizedStringWithDefaultValue(...)
.
Upvotes: 1