When pm used in multilingual env - title should be formated with plurals

CommentFileSizeAuthor
#9 pm_plural_d6.patch722 bytesandypost
#4 pm_plural_d6.patch704 bytesandypost

Comments

berdir’s picture

Status: Needs review » Closed (won't fix)

format_plural doesn't work for what we are doing there.. format_plurat is hardcoded for 1 or n, but we need 0 or n. And we need to do it always, even if language x doesn't use plural at all.

See #337989-20: Translation of messages menu breaks display of unread messages and my answer below

andypost’s picture

Status: Closed (won't fix) » Needs review

I post this patch wich works for me
Take a closer look - title changes only if ($count > 0) so there's no problem with plural forms

berdir’s picture

There is no patch :)

andypost’s picture

StatusFileSize
new704 bytes

Sorry, attaching again

berdir’s picture

Status: Needs review » Closed (won't fix)

Still, it doesn't make sense to use format_plural there, you are using the *same* text if there are one or multiple new messages. It would be completely different if it would state something like "1 message" vs. "n messages" but that text wouldn't make sense in that context.

andypost’s picture

Status: Closed (won't fix) » Needs review

It's really make sense for Russian language and maybe other - 1 message & n messages (pluralized 1 new and n new writes different)

berdir’s picture

Status: Needs review » Reviewed & tested by the community

I see..

patch is easy enough to be set to RTBC.

litwol’s picture

Status: Reviewed & tested by the community » Fixed

i modified it to use @count for single counts too, in case some one wants to translate it some how differently.

andypost’s picture

Status: Fixed » Needs review
StatusFileSize
new722 bytes

@litwol Your fix is wrong, check http://api.drupal.org/api/function/format_plural/6 second parameter $singular The string for the singular case. Please make sure it is clear this is singular, to ease translation (e.g. use "1 new comment" instead of "1 new"). Do not use @count in the singular string.

litwol’s picture

Title: privatemsg_title_callback should use format_plural » privatemsg_title_callback should use format_plural2
Status: Needs review » Fixed

technically my solution is not wrong, it gets the same job done differently.

copies these first 4 lines from format_plural that make my patch work as its intended

$args['@count'] = $count;
  if ($count == 1) {
    return t($singular, $args, $langcode);
  }

So this raises a question: is there any non-technical reason your method should be used over the one i chose?

litwol’s picture

Title: privatemsg_title_callback should use format_plural2 » privatemsg_title_callback should use format_plural

Sorry for the title change.

andypost’s picture

Status: Fixed » Needs review

@litwol Because strings for singular and plural should be different! Using gettext with same strings produce same translations. But in this case strings should be different!!! It's really needed else I can't translate this to russian! And maybe some other langs too.

litwol’s picture

Status: Needs review » Fixed

Ti prav :-) (English: You're right). Committed the fix.

andypost’s picture

Spasibo :) Thank you!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.