Locale-Sensitive Objective-C Method
Foundation NSNumberFormatter
setAttributedStringForNil
Internationalization (I18n) Method Overview
This method is used for fine grained tuning of number formats.
Click here
for additional Apple Developer Documentation details.
I18n Issues
Rather than utilize the System Defaults Database of locale formats, this explicitly overrides the formatting.
While whatever is provided may be appropriate for English and a few other preset locales, this may not serve
all
locales in the future. Even tuning the attribute strings size and color features could require locale
sensitivity
for cultural or legibility reasons. Some things like currency symbol may need to operate independently of
locale,
but it's unlikely one needs to tweak very many of these features.
Resolution:
- Check for completeness - to be sure that you are providing 3 or 2 semi-colon separated patterns
(positive-zero-negative or positive-negative)
- Consider going back to system locale-specific defaults
- Expose the formats as resources to be determined by localization engineers
- Use
localizedStringFromNumber:numberStyle: so it is more template driven across locales.
Generally one needs to pass in locale , encoding or language to ensure
that any culture-dependent conversion is done properly.
If you determine that the call is i18n-safe, you can use Globalyzer's
Ignore Comment functionality to ensure that it isn't
picked up in a subsequent scan.
For information about Objective-C Internationalization, click here.
|