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

  • Home
  • SEARCH
  • 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 6703823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:13:01+00:00 2026-05-26T07:13:01+00:00

I think we’ve all run into the issue before where an app says that

  • 0

I think we’ve all run into the issue before where an app says that there are “1 minutes remaining”, or something along those lines. I think this observation is a testament to the fact that many programmers ignore this issue.

In my projects, I’ve typically done something along these lines to account for pluralizing nouns:

$Count = count($Items);
$Noun = 'minute';
if ($Count != 1)
{
    $Noun .= 's';
}

echo sprintf('There are %u %s remaining.', $Count, $Noun);

I have a couple issues with this approach:

  1. It places the onus on the programmer to do this pluralization check every single time a string needs to be generated, so code can never be reused.
  2. It needlessly bloats the application code and inhibits readability.
  3. It is not generic. The example worked because “minutes” is the plural of “minute”. What about “sheep”, “ox”, or “fungus”?

Does anyone have any ideas for a generic, modular approach to solve this problem? I’m ok with there being more than just one answer.

  • 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-26T07:13:02+00:00Added an answer on May 26, 2026 at 7:13 am

    It is common to implement a function that accepts a number and all singular and plural adjectives.

    So sample invocation could be

    echo 'There are ' $count . ' ' . pluralize($count, array('minute', 'minutes')) . ' remaining';
    

    If you’ll decide to translate your application into many languages this link will help to pluralize correctly: http://translate.sourceforge.net/wiki/l10n/pluralforms

    ps: the propisal I made will work fine with any languages in case if you pass additional 3rd parameter language that will specify which pluralization formula to use.

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

Sidebar

Related Questions

Think that says it all?
I think that I am misunderstanding something about how jquery $(this) works. In my
I think I got all the steps down but I must be missing something
Think that I have many activities,and all I want is this: I have a
Think I have domain.com that redirects into some.otherdomain.com . I don't want to show
Think Global, Act Local That's what they tell you, however during all my time
I think I read somewhere that you could bind multiple definitions to a single
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I think that asking this might be kind of silly but I'm still wondering
I think I'm missing something basic here. Why is the third IF condition true?

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.