I am loading the translation through a JSON file every time I launch the application. Could I parse that JSON, clean it up and place it in the localizable.strings file?
If not, will I be able to load localization from localizable file created in the Documents directory?
Localizable. strings file is where you add translation data as key-value pairs. Earlier versions of XCode used to generate a Localizable. strings file by default, and we were able to easily duplicate the Localizable. strings file for other languages.
Step 1: Create Localizable.Select File → New → File… or just tap Ctrl+N or Cmd+N . Search for strings and you will see Strings File in Resource window: Choose Strings File and name the file Localizable : Now, let's select Localizable.
Dynamic localization is the suppression of the broadening of a charged-particle wave packet as it moves along a periodic potential in an a.c. electric field1,2,3.
NSLocalizedString is a macros for denoting strings as user-facing. (A macros is used to make tasks using the application less repetitive.) It has two arguments: a key, which uniquely identifies the string to be localized, and a comment, a string that is used to provide sufficient context for accurate translation.
no the first as you can't edit app resources after deployment
you can however tell NSBundle to use a different localizeFile.. or rather download the json and put it in a NSBundle
put the localizable into:
<APP/DOCUMENTS>/<APPNAME>.bundle/<LANGUAGE_CODE>.lproj/Localizable.strings
init a new cocoa bundle
NSBundle *b = [NSBundle bundleWithPath:@"<APP/DOCUMENTS>/<APPNAME>.bundle/"];
then just use this on the bundle:
- (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName
e.g.
[b localizedStringForKey:@"HIHO" value:nil table:nil];
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