Re: [poedit-users] Plural detection fail
MASSUCHETTI Jonathan <[email protected]> Sun, 30 May 2010 11:33:26 +0000
| Newsgroups | gmane.editors.poedit.user |
|---|---|
| Message-ID | <[email protected]> |
--===============2455008107616672429== Content-Type: multipart/alternative; boundary=0015174c13dcd64ba80487ce1be8 --0015174c13dcd64ba80487ce1be8 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable plural:1,2 as keyword works. Many thanks. 2010/5/30 Vaclav Slavik <[email protected]> > On Sat, 2010-05-29 at 19:55 +0000, MASSUCHETTI Jonathan wrote: > > As you see, my plural is ignored. Why and how to fix ? > > You need to specify the plural form keyword correctly, as xgettext wants > it: > > =91-k[keywordspec]=92 > =91--keyword[=3Dkeywordspec]=92 > Specify keywordspec as an additional keyword to be looked for. > Without a keywordspec, the option means to not use default > keywords. > > If keywordspec is a C identifier id, xgettext looks for strings > in the first argument of each call to the function or macro id. > If keywordspec is of the form =91id:argnum=92, xgettext looks for > strings in the argnumth argument of the call. If keywordspec is > of the form =91id:argnum1,argnum2=92, xgettext looks for strings i= n > the argnum1st argument and in the argnum2nd argument of the > call, and treats them as singular/plural variants for a message > with plural handling. Also, if keywordspec is of the form > =91id:contextargnumc,argnum=92 or =91id:argnum,contextargnumc=92, > xgettext treats strings in the contextargnumth argument as a > context specifier. And, as a special-purpose support for GNOME, > if keywordspec is of the form =91id:argnumg=92, xgettext recognize= s > the argnumth argument as a string with context, using the GNOME > glib syntax =91"msgctxt|msgid"=92. > Furthermore, if keywordspec is of the form > =91id:...,totalnumargst=92, xgettext recognizes this argument > specification only if the number of actual arguments is equal to > totalnumargs. This is useful for disambiguating overloaded > function calls in C++. > Finally, if keywordspec is of the form > =91id:argnum...,"xcomment"=92, xgettext, when extracting a message > from the specified argument strings, adds an extracted comment > xcomment to the message. Note that when used through a normal > shell command line, the double-quotes around the xcomment need > to be escaped. > > This option has an effect with most languages, namely C, C++, > ObjectiveC, Shell, Python, Lisp, EmacsLisp, librep, Java, C#, > awk, Tcl, Perl, PHP, GCC-source, Glade. > > The default keyword specifications, which are always looked for > if not explicitly disabled, are language dependent. They are: > > * For C, C++, and GCC-source: gettext, dgettext:2, > dcgettext:2, ngettext:1,2, dngettext:2,3, > dcngettext:2,3, gettext_noop, and pgettext:1c,2, > dpgettext:2c,3, dcpgettext:2c,3, npgettext:1c,2,3, > dnpgettext:2c,3,4, dcnpgettext:2c,3,4. > * For Objective C: Like for C, and also NSLocalizedString, > _, NSLocalizedStaticString, __. > * For Shell scripts: gettext, ngettext:1,2, eval_gettext, > eval_ngettext:1,2. > * For Python: gettext, ugettext, dgettext:2, ngettext:1,2, > ungettext:1,2, dngettext:2,3, _. > * For Lisp: gettext, ngettext:1,2, gettext-noop. > * For EmacsLisp: _. > * For librep: _. > * For Scheme: gettext, ngettext:1,2, gettext-noop. > * For Java: GettextResource.gettext:2, > GettextResource.ngettext:2,3, > GettextResource.pgettext:2c,3, > GettextResource.npgettext:2c,3,4, gettext, ngettext:1,2, > pgettext:1c,2, npgettext:1c,2,3, getString. > * For C#: GetString, GetPluralString:1,2, > GetParticularString:1c,2, > GetParticularPluralString:1c,2,3. > * For awk: dcgettext, dcngettext:1,2. > * For Tcl: ::msgcat::mc. > * For Perl: gettext, %gettext, $gettext, dgettext:2, > dcgettext:2, ngettext:1,2, dngettext:2,3, > dcngettext:2,3, gettext_noop. > * For PHP: _, gettext, dgettext:2, dcgettext:2, > ngettext:1,2, dngettext:2,3, dcngettext:2,3. > * For Glade 1: label, title, text, format, copyright, > comments, preview_text, tooltip. > > To disable the default keyword specifications, the option =91-k=92 > or =91--keyword=92 or =91--keyword=3D=92, without a keywordspec, c= an be > used. > > IOW, just "plural" is not enough for plural forms, you need to add ':' > and argnum(s) to it. > > Regards, > Vaclav > > > -------------------------------------------------------------------------= ----- > > > _______________________________________________ > Poedit-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/poedit-users > > --0015174c13dcd64ba80487ce1be8 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable plural:1,2=A0=A0=A0 as keyword works.<br><br>Many thanks.<br><br><div class= =3D"gmail_quote">2010/5/30 Vaclav Slavik <span dir=3D"ltr"><<a href=3D"m= ailto:[email protected]">[email protected]</a>></span><br><blockquot= e class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; border-left: 1p= x solid rgb(204, 204, 204); padding-left: 1ex;"> <div class=3D"im">On Sat, 2010-05-29 at 19:55 +0000, MASSUCHETTI Jonathan w= rote:<br> > As you see, my plural is ignored. Why and how to fix ?<br> <br> </div>You need to specify the plural form keyword correctly, as xgettext wa= nts<br> it:<br> <br> =91-k[keywordspec]=92<br> =91--keyword[=3Dkeywordspec]=92<br> =A0 =A0 =A0 =A0Specify keywordspec as an additional keyword to be looked f= or.<br> =A0 =A0 =A0 =A0Without a keywordspec, the option means to not use default<= br> =A0 =A0 =A0 =A0keywords.<br> <br> =A0 =A0 =A0 =A0If keywordspec is a C identifier id, xgettext looks for str= ings<br> =A0 =A0 =A0 =A0in the first argument of each call to the function or macro= id.<br> =A0 =A0 =A0 =A0If keywordspec is of the form =91id:argnum=92, xgettext loo= ks for<br> =A0 =A0 =A0 =A0strings in the argnumth argument of the call. If keywordspe= c is<br> =A0 =A0 =A0 =A0of the form =91id:argnum1,argnum2=92, xgettext looks for st= rings in<br> =A0 =A0 =A0 =A0the argnum1st argument and in the argnum2nd argument of the= <br> =A0 =A0 =A0 =A0call, and treats them as singular/plural variants for a mes= sage<br> =A0 =A0 =A0 =A0with plural handling. Also, if keywordspec is of the form<b= r> =A0 =A0 =A0 =A0=91id:contextargnumc,argnum=92 or =91id:argnum,contextargnu= mc=92,<br> =A0 =A0 =A0 =A0xgettext treats strings in the contextargnumth argument as = a<br> =A0 =A0 =A0 =A0context specifier. And, as a special-purpose support for GN= OME,<br> =A0 =A0 =A0 =A0if keywordspec is of the form =91id:argnumg=92, xgettext re= cognizes<br> =A0 =A0 =A0 =A0the argnumth argument as a string with context, using the G= NOME<br> =A0 =A0 =A0 =A0glib syntax =91"msgctxt|msgid"=92.<br> =A0 =A0 =A0 =A0Furthermore, if keywordspec is of the form<br> =A0 =A0 =A0 =A0=91id:...,totalnumargst=92, xgettext recognizes this argume= nt<br> =A0 =A0 =A0 =A0specification only if the number of actual arguments is equ= al to<br> =A0 =A0 =A0 =A0totalnumargs. This is useful for disambiguating overloaded<= br> =A0 =A0 =A0 =A0function calls in C++.<br> =A0 =A0 =A0 =A0Finally, if keywordspec is of the form<br> =A0 =A0 =A0 =A0=91id:argnum...,"xcomment"=92, xgettext, when ext= racting a message<br> =A0 =A0 =A0 =A0from the specified argument strings, adds an extracted comm= ent<br> =A0 =A0 =A0 =A0xcomment to the message. Note that when used through a norm= al<br> =A0 =A0 =A0 =A0shell command line, the double-quotes around the xcomment n= eed<br> =A0 =A0 =A0 =A0to be escaped.<br> <br> =A0 =A0 =A0 =A0This option has an effect with most languages, namely C, C+= +,<br> =A0 =A0 =A0 =A0ObjectiveC, Shell, Python, Lisp, EmacsLisp, librep, Java, C= #,<br> =A0 =A0 =A0 =A0awk, Tcl, Perl, PHP, GCC-source, Glade.<br> <br> =A0 =A0 =A0 =A0The default keyword specifications, which are always looked= for<br> =A0 =A0 =A0 =A0if not explicitly disabled, are language dependent. They ar= e:<br> <br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For C, C++, and GCC-source: gettext, dgettext= :2,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dcgettext:2, ngettext:1,2, dngettext:2,3,<b= r> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dcngettext:2,3, gettext_noop, and pgettext:= 1c,2,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dpgettext:2c,3, dcpgettext:2c,3, npgettext:= 1c,2,3,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dnpgettext:2c,3,4, dcnpgettext:2c,3,4.<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For Objective C: Like for C, and also NSLocal= izedString,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0_, NSLocalizedStaticString, __.<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For Shell scripts: gettext, ngettext:1,2, eva= l_gettext,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0eval_ngettext:1,2.<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For Python: gettext, ugettext, dgettext:2, ng= ettext:1,2,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ungettext:1,2, dngettext:2,3, _.<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For Lisp: gettext, ngettext:1,2, gettext-noop= .<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For EmacsLisp: _.<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For librep: _.<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For Scheme: gettext, ngettext:1,2, gettext-no= op.<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For Java: GettextResource.gettext:2,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0GettextResource.ngettext:2,3,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0GettextResource.pgettext:2c,3,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0GettextResource.npgettext:2c,3,4, gettext, = ngettext:1,2,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0pgettext:1c,2, npgettext:1c,2,3, getString.= <br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For C#: GetString, GetPluralString:1,2,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0GetParticularString:1c,2,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0GetParticularPluralString:1c,2,3.<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For awk: dcgettext, dcngettext:1,2.<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For Tcl: ::msgcat::mc.<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For Perl: gettext, %gettext, $gettext, dgette= xt:2,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dcgettext:2, ngettext:1,2, dngettext:2,3,<b= r> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dcngettext:2,3, gettext_noop.<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For PHP: _, gettext, dgettext:2, dcgettext:2,= <br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ngettext:1,2, dngettext:2,3, dcngettext:2,3= .<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0* For Glade 1: label, title, text, format, copy= right,<br> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0comments, preview_text, tooltip.<br> <br> =A0 =A0 =A0 =A0To disable the default keyword specifications, the option = =91-k=92<br> =A0 =A0 =A0 =A0or =91--keyword=92 or =91--keyword=3D=92, without a keyword= spec, can be<br> =A0 =A0 =A0 =A0used.<br> <br> IOW, just "plural" is not enough for plural forms, you need to ad= d ':'<br> and argnum(s) to it.<br> <br> Regards,<br> <font color=3D"#888888">Vaclav<br> </font><br>----------------------------------------------------------------= --------------<br> <br> <br>_______________________________________________<br> Poedit-users mailing list<br> <a href=3D"mailto:[email protected]">[email protected]= urceforge.net</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/poedit-users" targe= t=3D"_blank">https://lists.sourceforge.net/lists/listinfo/poedit-users</a><= br> <br></blockquote></div><br> --0015174c13dcd64ba80487ce1be8-- --===============2455008107616672429== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ------------------------------------------------------------------------------ --===============2455008107616672429== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Poedit-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/poedit-users --===============2455008107616672429==--