Should i use _n for pronouns in translation?

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.

Read More

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?

Related posts

Leave a Reply

2 comments

  1. 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).

  2. 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');