This question is continuum to that one: iOS - Could I change the localizable.strings content during runtime?
The answer was useful, however, there is a problem that I am facing. The printed string doesn't include quotations (like these "") for single word keys and/or values. This made the Localizable.string invalid file. Hence, nothing is retrieved from it even for keys/values with correct format.
Example:
GBP = GBP; Glossary = Glossary; "Go_Location" = "Go to location";
First two are causing the file to be invalid strings file. How to fix that?
Use NSDictionary's
- (NSString *)descriptionInStringsFileFormat;
Then write the resulting string to a file using the appropriate encoding:
NSString* strings = [dict descriptionInStringsFileFormat];
[strings writeToFile: @"Localizable.strings" atomically: YES encoding: NSUTF16StringEncoding error: nil];
(Obviously add whatever error checking you need).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With