Forum: Ruby on Rails gettext .po msgid_plural failed

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Arthur C. (Guest)
on 2009-02-06 05:54
Hi All,

I am using gettext and .po files for my translation, however, I found it
very difficult to apply plural form translation, is there anything goes
wrong?

in controller:

<%=h _("You received %{no_friend} friend invitation") %{:no_friend =>
pending_friends_for_user.length } %><br/>


in en/myapp.po


msgid ""
msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n"
"X-Poedit-Country: UNITED STATES\n"


#: app/views/friends/_pending_friends_for_user.rhtml:-
msgid "You received %{no_friend} friend invitation"
msgid_plural "You received %{no_friend} friend invitations"
msgstr[0] "You received %{no_friend} friend invitation"
msgstr[1] "You received %{no_friend} friend invitations"




Is there anything goes wrong?

Any help is appreicated, I hope not making obvious mistake here.

Thanks again!
Arthur
This topic is locked and can not be replied to.