I use _x() now! I accepted the answer just because he understood right and was first. So don't get confused!

$like_me_on = __('Like me on %s', 'my-plugin');
$like_us_on = __('Like us on %s', 'my-plugin');

$follow_me_on = __('Follow me on %s', 'my-plugin');
$follow_us_on = __('Follow us on %s', 'my-plugin');

$my_x_profile = __('My %s profile', 'my-plugin');
$our_x_profile = __('Our %s profile', 'my-plugin');

I have this code and i read about _n() and saw only examples with $count on wordpress codex.

The text is for a bunch of social services that will later be %s, if i would use _n then i would have this variables combined, but the translation string would be more complicated to read. So what is best practice and is this intended for pronouns or just for numbers?

2 Answers 2


It's interesting idea and I think that such approach will work for you. What I would recommend you is that it will be better to use constructions like this:

// $singular = 1 - for 'me', 2 - for 'us'
$like_on = _n('Like me on %s', 'Like us on %s', $singular, 'my-plugin');

In this case it will be easier to understand how to translate the phrase.

Also read this question How-to: Translate plural forms for themes/plugins with PoEdit to understand how to configure your poedit to support plural forms with WordPress keywords (like _n, _n_noop, _nx and _nx_noop).

  • well the first example you are showing is exactly what i taught about, don't know why i typed this _n('%1$s %2$s Profile' ... stuff. regarding poedit that the thing, it might be more complicated to set it up for this and this might be bad for translators. i will not look into this because i prefer the "codestyle localisation" plugin is that awesome and easy nothing to setup just install and translate, no setup no uploads all inside WP. I guess this is more a opinion Question. After all it 2 seperate strings to translate. Feb 25, 2013 at 12:28
  • After thinking about this i guess i over-thought this. When the stings follow each other in the code it might be simpler to just leaf it as it is ;) Lets here one more opinion. Feb 25, 2013 at 12:29
  • I use _x() now! I accepted the answer just because he understood right and was first. So don't get confused! Feb 25, 2013 at 17:18

No, you should not. Use _n() when the placeholder can contain different numbers. _n() is not for cases where the amount is hard coded in the string.

What you should use is a context parameter:

$our_x_profile = _x('Our %s profile', 'Social services like Facebook', 'my-plugin');
  • What will be the result of such translation? The question is about pronouns... Feb 25, 2013 at 13:21
  • He is right you miss-understood the question, even if i am thankful for the idea about the context thing. I was asking about pronouns. But i guess i will use this 2 times then. I guess there is no combination of _n and _x and thats probably a good thing ;) Feb 25, 2013 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.