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 6941921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:56:53+00:00 2026-05-27T12:56:53+00:00

I incorporated a gettext-like localization system in my app, but my translation function looks

  • 0

I incorporated a gettext-like localization system in my app, but my translation function looks like this:

 t($category, $string, [$plural_string, $number, $vprintf_arguments])

My PoEdit keywords:

t:2
t:2,3
  • t:2 tells PoEdit to parse $string, and it works apparently
  • t:2,3 should tell PoEdit to parse both $string and $plural_string – but it’s not 🙁

It only sees $string, so I don’t get the plural forms parsed… How can I fix that? I don’t want to switch my function to a different argument format because I like this one 🙁

Also this function acts like a sprintf replacement:

  • if 3rd argument ($plural_string) is a array, then the function will consider the values from the array as arguments to vsprintf
  • if 3rd argument is a string and $number is provided, the function will consider $vprintf_arguments as arguments to vsprintf (if they are provided), and $plural_string as the plural form of $string

Anyway PoEdit should not interfere with non quoted arguments, right? I mean it will only parse $plural_string as string if it looks like 'abc abc'

  • 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-27T12:56:54+00:00Added an answer on May 27, 2026 at 12:56 pm

    gettext only deals with one string at a time.
    What you may be after is ngettext. (look it up for syntax)

    There, you’ll put in one text for singular, another for plural, but also the number.

    The smart thing about this is, that many languages have a totally different plural structure, than English.
    Russian, for instance, uses three different forms.
    One is for where the count ends in a pronounced ‘one’:
    1, 21, 31, 41 etc.
    The second form is for counts, which end in a pronounced 2, 3 or 4.
    The third form is for the rest…

    And, with ngettext, this can be done.
    Yeah, in poedit, one has to correctly define the target language’s plural structure, but then, it just works.

    http://www.gnu.org/s/hello/manual/gettext/Plural-forms.html

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

Sidebar

Related Questions

I have incorporated the mini-profiler in mvc app but I have a question. When
I've currently got TinyMCE incorporated into the backend editor of a simple blogging/page-editing app,
I'm using JSF 2.0 and it's new (actually old, but now incorporated in JSF)
I've incorporated an Iframe 'Like' button into every page of my website - http://www.newforestexplorersguide.co.uk
I'm using this free Web Template - EliteCircle and have just incorporated it into
I have a C# .NET 3.5 app that I have incorporated the DragDrop event
As I've developed my app, I have imported and incorporated a lot of images,
The following code works fine as a independant page as itself. But if incorporated
I'm building a custom RSS reader app with incorporated feed link view (UIWebView). Using
New to using the click function. FIrst I incorporated it in a function triggered

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.