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

2015-10-03 Thread Sébastien Wilmet
On Fri, Oct 02, 2015 at 04:48:31PM -0400, Shaun McCance wrote:
> On Fri, 2015-10-02 at 19:55 +0200, Sébastien Wilmet wrote:
> > 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

Thanks for your quick answer. I'll do the same in GtkSourceView then.

Maybe the Autotools/gettext/VCS integration should be documented on:
http://itstool.org/documentation/

> 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.

>From what I understand, I think it's because gettext doesn't support
files in POTFILES.in that need to be generated (generated in builddir of
course).

> 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
> =7a17583f

Oh, great!

> 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.

To mark XML attributes as translatable, a common thing to do is to
prefix them with an underscore. Intltool supports that, but not gettext
AFAIK. If the ITS branch supports that, it would cover lots of simple
cases.

Cheers,
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-03 Thread Philip Chimento
On Sat, Oct 3, 2015 at 12:49 AM, Alexandre Franke <
alexandre.fra...@gmail.com> wrote:

> On Sat, Oct 3, 2015 at 4:40 AM, Philip Chimento
>  wrote:
> > 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.
>
> Are you updating the pot file every time you change strings in your
> source code? This is not the recommended workflow for GNOME
> translation and you're giving bad habits to anyone you're pointing to
> this file. Damned lies provides an up to date pot file for all modules
> and ensures translations are never based on the wrong file.
>

I'm talking about non-Gnome projects; when there is a different recommended
workflow that translators are used to, I would use that.

But to answer your question; no, I purposely don't update the .pot file
every time I change a string. I only update the .pot file when I want to
release new strings to translators, some time before a release.

Regards,
-- 
Philip
___
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-03 Thread Alexandre Franke
On Sat, Oct 3, 2015 at 4:40 AM, Philip Chimento
 wrote:
> 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.

Are you updating the pot file every time you change strings in your
source code? This is not the recommended workflow for GNOME
translation and you're giving bad habits to anyone you're pointing to
this file. Damned lies provides an up to date pot file for all modules
and ensures translations are never based on the wrong file.

-- 
Alexandre Franke
___
desktop-devel-list mailing list
desktop-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/desktop-devel-list


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
=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