On Fri, Jan 30, 2009 at 2:01 AM, Josip <josip@pisoj.com> wrote:
Benny Malengier wrote:
>
>
> 2009/1/30 Josip <josip@pisoj.com <mailto:josip@pisoj.com>>
>
>     jerome wrote:
>     > Doug,
>     >
>     >
>     > I made a minor change on gen/lib/date.py :
>     >
>     http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/gen/lib/date.py?r1=11703&r2=11702&pathrev=11703
>     <http://gramps.svn.sourceforge.net/viewvc/gramps/trunk/src/gen/lib/date.py?r1=11703&r2=11702&pathrev=11703>
>     > (translations were missing on RelationshipsView and Age Gramplet)
>     >
>     > + context for "about" (could be used for age or date)
>     > + make gramps.pot was not able to retrieve strings dealing with
>      ngettext based code.
>     >
>     > from gettext import ngettext as _s
>     > i.e: (_s("%d year", "%d years", diff_tuple[0]) % diff_tuple[0])
>     >
>     > it is OK with :
>     >
>     > (_s(_("%d year"), _("%d years"), diff_tuple[0]) % diff_tuple[0])
>     >
>     > I let ngettext but seems we do not need it any more ?
>     >
>     >
>
>     if changed to:
>     ngettext("%d year", "%d years", diff_tuple[0]) % diff_tuple[0]
>
>     make gramps.pot produce:
>     #: ../src/gen/lib/date.py:487
>     #, python-format
>     msgid "%d year"
>     msgid_plural "%d years"
>     msgstr[0] ""
>     msgstr[1] ""
>
>     from Makefile its look they use xgettext
>
>
> So you say the import statement is not recognized and really ngettext as
> a string must be used?

Yes

> As the extraction of strings is based on parsing this could be the case.
> Jerome, can you make sure the code is again the original
>
> from gettext import ngettext
> ....
>  ngettext("%d year", "%d years", diff_tuple[0]) % diff_tuple[0])
>
> translate french and see how it goes.
>
> I think if context is needed, ngettext can be used from TransUtils and
> all will go, we should check if/when needed.
>


make gramps.pot seems to invoke xgettext to exstract translatable
strings, but xgettext don't know  anything about your shorthand "_s" for
"ngettext" so must be invoked with extra switch like:
xgettext --keyword=_s:1,2 and to do that it must be instructed from
Makefiles or just use "ngettext" keyword in sources becouse it is one of
default keyword for python files

--
Josip


Note that I just made up _s() ... I have no idea if there are standards...

-Doug
 

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gramps-devel mailing list
Gramps-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gramps-devel