localization - Using ".stringsdict" file with 'localizedStringWithFormat' --> Are NUMERALS localized for you? -
i trying produce following localized string:
"in ___ day(s)" --> (ex: in 5 days)
to accomplish this, i've gone down .stringsdict route:
<key>in %d days</key> <dict> <key>nsstringlocalizedformatkey</key> <string>%#@days@</string> <key>days</key> <dict> <key>nsstringformatspectypekey</key> <string>nsstringpluralruletype</string> <key>nsstringformatvaluetypekey</key> <string>d</string> <key>zero</key> <string>today</string> <key>one</key> <string>in %d day</string> <key>other</key> <string>in %d days</string> </dict> </dict>
i use following, obtain localized string:
nsinteger days = ...; localizedduedatestring = [nsstring localizedstringwithformat:nslocalizedstring(@"in %d days", @"indicates days"),abs(days)];
this correctly outputs string accounts plurality. example:
in 1 day in 4 days
i wondering if "1" , "4" here localized correct. other languages, arabic example, have different symbols numerals. expect above string use symbol "٤" instead of "4", arabic.
i know can accomplished using nsnumberformatter, how can accomplish numeral localization while respecting plurality visa vi .stringsdict file?
yes
numerals appear correctly swapped when using .stringsdict file in coordination "localizedstringwithformat" method!
i switched ipad language arabic, , output for
in 1 day
was...
١ day in
i don't have arabic localization done yet, "in" , "day" english, numeral appears correctly localized. no need nsnumberformatter
Comments
Post a Comment