Integrate ITS Tool with gettext and Autotools (Was: Re: Death of gnome-common)

2015-10-02 Thread Sébastien Wilmet
Hi,

On Wed, Jun 24, 2015 at 02:17:52PM +0100, Emmanuele Bassi wrote:
> On 24 June 2015 at 14:13, Michael Catanzaro  wrote:
> > On Wed, 2015-06-24 at 08:56 +0100, Emmanuele Bassi wrote:
> >> I do hope that, if you're using glib-gettext or intltool, you spend a
> >> little bit of time to port to upstream gettext instead.
> >
> > Has anyone written a guide on how to do this?
> 
> It's the same guide as using gettext. Upstream gettext recognises
> desktop files, GSettings schemas, as well as GtkBuilder XML
> definitions.
> 
> Sadly, it's still in use for AppData XML, but for that (and any other
> XML-based format) there's itstool, which is also used by the
> documentation team for the application help:
> 
>http://itstool.org/

I have a question about how to integrate ITS Tool with upstream gettext
and Autotools (and Git).

I have a branch in GtkSourceView to use upstream gettext and itstool:
https://git.gnome.org/browse/gtksourceview/log/?h=wip/dont-use-intltool

ITS Tool generates *.pot files that can be added to the POTFILES.in.
I've tried to not add the generated *.pot files to Git, because
generated files should not be added to the version control system. But
then there are problems with builddir != srcdir. For tarballs the
solution is easy: distribute the generated sub *.pot files in the
tarball. But when compiling from the git repository, some make targets
don't work with builddir != srcdir.

So a solution is to add the generated *.pot files to Git.

Is there another solution?

The gettext documentation doesn't recommend to add generated files in
the POTFILES.in:
https://www.gnu.org/software/gettext/manual/html_node/po_002fPOTFILES_002ein.html

When a file is present in POTFILES.in, the make target supposes that the
file is in srcdir. So adding a make target (in a gettext Rules file that
is added to the po/Makefile) to build that file in builddir won't help
when builddir != srcdir.

Maybe a solution is to modify po/Makefile.in.in, like it is done in GTK+
(but not for using ITS Tool). But I'd rather keep things simple.

Is there a recommended way of doing things?

Thanks in advance,
Sébastien
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/desktop-devel-list


Re: Integrate ITS Tool with gettext and Autotools (Was: Re: Death of gnome-common)

2015-10-02 Thread Shaun McCance
On Fri, 2015-10-02 at 19:55 +0200, Sébastien Wilmet wrote:
> Hi,
> 
> On Wed, Jun 24, 2015 at 02:17:52PM +0100, Emmanuele Bassi wrote:
> > On 24 June 2015 at 14:13, Michael Catanzaro 
> > wrote:
> > > On Wed, 2015-06-24 at 08:56 +0100, Emmanuele Bassi wrote:
> > > > I do hope that, if you're using glib-gettext or intltool, you
> > > > spend a
> > > > little bit of time to port to upstream gettext instead.
> > > 
> > > Has anyone written a guide on how to do this?
> > 
> > It's the same guide as using gettext. Upstream gettext recognises
> > desktop files, GSettings schemas, as well as GtkBuilder XML
> > definitions.
> > 
> > Sadly, it's still in use for AppData XML, but for that (and any
> > other
> > XML-based format) there's itstool, which is also used by the
> > documentation team for the application help:
> > 
> >http://itstool.org/
> 
> I have a question about how to integrate ITS Tool with upstream
> gettext
> and Autotools (and Git).
> 
> I have a branch in GtkSourceView to use upstream gettext and itstool:
> https://git.gnome.org/browse/gtksourceview/log/?h=wip/dont-use-intlto
> ol
> 
> ITS Tool generates *.pot files that can be added to the POTFILES.in.
> I've tried to not add the generated *.pot files to Git, because
> generated files should not be added to the version control system.
> But
> then there are problems with builddir != srcdir. For tarballs the
> solution is easy: distribute the generated sub *.pot files in the
> tarball. But when compiling from the git repository, some make
> targets
> don't work with builddir != srcdir.
> 
> So a solution is to add the generated *.pot files to Git.
> 
> Is there another solution?

This is what yelp and yelp-xsl do. They have XML files of translated
strings for use in XSLT. It's a home-brewed XSLT gettext system. Here's
the Makefile.am that manages the POT file:

https://git.gnome.org/browse/yelp-xsl/tree/xslt/common/domains/Makefile
.am

Here's the POT file in git:

https://git.gnome.org/browse/yelp-xsl/tree/xslt/common/domains/yelp-xsl
.pot

Here's the POTFILES.in:

https://git.gnome.org/browse/yelp-xsl/tree/po/POTFILES.in

Yes, putting generated files in git is dirty. But it does work, and I
haven't gotten any complaints about it. If somebody has a suggestion on
how to do this differently, I'm all ears.

Daiki has been working on adding ITS support to gettext, so you will be
able to do arbitrary XML with ITS without external tools. Here's his
work-in-progress:

http://git.savannah.gnu.org/cgit/gettext.git/commit/?h=wip/ueno/its2&id
=7a17583f

I don't think gettext's XML support will grow to the point where it can
handle complex documentation, but this is probably the way forward for
simple XML data files.

> The gettext documentation doesn't recommend to add generated files in
> the POTFILES.in:
> https://www.gnu.org/software/gettext/manual/html_node/po_002fPOTFILES
> _002ein.html
> 
> When a file is present in POTFILES.in, the make target supposes that
> the
> file is in srcdir. So adding a make target (in a gettext Rules file
> that
> is added to the po/Makefile) to build that file in builddir won't
> help
> when builddir != srcdir.
> 
> Maybe a solution is to modify po/Makefile.in.in, like it is done in
> GTK+
> (but not for using ITS Tool). But I'd rather keep things simple.
> 
> Is there a recommended way of doing things?
> 
> Thanks in advance,
> Sébastien
> ___
> desktop-devel-list mailing list
> desktop-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/desktop-devel-list
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/desktop-devel-list

Re: Integrate ITS Tool with gettext and Autotools (Was: Re: Death of gnome-common)

2015-10-02 Thread Philip Chimento
On Fri, Oct 2, 2015 at 10:55 AM, Sébastien Wilmet  wrote:

> I've tried to not add the generated *.pot files to Git, because
> generated files should not be added to the version control system.


For what it's worth, I break that rule for .pot files in my own projects,
because adding them to Git makes it easier for people who aren't
comfortable with the command line to contribute translations.

Regards,
-- 
Philip
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/desktop-devel-list