Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 534793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:38:58+00:00 2026-05-13T09:38:58+00:00

In my iPhone app, I need to display object counts which I then localize,

  • 0

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

if (objectList.count == 1)
{
   NSLog(@"%@", NSLocalizedString(@"1 object", @"display one objects");
}
else
{
  NSLog(@"%@", NSLocalizedString(@"%d objects", @"display multiple objects");
}

This works for English but in many other languages the plural form of a noun is not simply constructed by adding an ‘s’.

As this page explains, there are two things which can differ between languages:

  • The form how plural forms are built differs. This is a problem with
    languages which have many
    irregularities. German, for instance,
    is a drastic case. Though English and
    German are part of the same language
    family (Germanic), the almost regular
    forming of plural noun forms
    (appending an ‘s’) is hardly found in
    German.
  • The number of plural forms differ. This is somewhat surprising for those
    who only have experiences with Romanic
    and Germanic languages since here the
    number is the same (there are two).

How should I deal with this in my code?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:38:59+00:00Added an answer on May 13, 2026 at 9:38 am

    NSLocalizedString is going to be reading from a string table in your app bundle. Therefore, the list of languages you need to support is known at compile time. Rather than worry about how to code for every possible language, just support the ones you are supporting.

    If your translator comes to you and says that, to support Martian, you need a separate spelling for even and odd numbers, you can adjust your code then, to something like:

    if (objectList.count == 1) {
        NSLocalizedString(@"ObjectCount1", @"display one");
    } else if (objectList.count % 2 == 0) {
        NSLocalizedString(@"ObjectCountEven", @"display even");
    } else if (objectList.count % 2 == 0) {
        NSLocalizedString(@"ObjectCountOdd", @"display odd");
    }
    

    en.lproj/Localizable.strings:

    ObjectCount1 = "1 object";
    ObjectCountEven = "%d objects";
    ObjectCountOdd = "%d objects"; // same as ObjectCountEven
    

    mars.lproj/Localizable.strings:

    ObjectCount1 = "1 object-o";
    ObjectCountEven = "%d object-e";
    ObjectCountOdd = "%d object-o"; // same as ObjectCount1
    

    Sorry if this sounds less than ideal, but human languages are messy and irregular, so it’s a waste of time to try to find an elegant, unified, common solution for them all. There isn’t one.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building an iPhone app that will need to display info primarily in
I need to have a few buttons in my iPhone app (which may be
I need the the cell-id information to display in my iphone app, the app
I am new to iphone app developing and need to display a PDF file
I need to display a list of latest tweets in my iPhone app, and
I am building an Iphone app. I need to display a settings Menu to
I need some modal view on iPhone app where I will display few labels,
For an iPhone app, I'm going to need to display read-only tabular data in
In my iPhone app I need to round an integer to the nearest multiple
I am making my first major iPhone app and need some advice in saving

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.