How to localize numbers for iPhone app?

前端 未结 5 1279
南方客
南方客 2021-02-08 14:41

In my iPhone app, I need to display object counts which I then localize, since English makes the distinction of singular and plural, I do the following

// pseudocode

5条回答
  •  攒了一身酷
    2021-02-08 15:04

    By the way, starting in iOS 7 and Mac OS X 10.9, there is built-in support for plurals in localization. See the WWDC 2013 video "Making Your App World-Ready" starting at 16:10. Plurals are localized in a .stringsdict plist file, and then you just do

    NSLog(@"%@", [NSString localizedStringWithFormat:
              NSLocalizedString(@"%d objects", @"display multiple objects"), n]);
    

提交回复
热议问题