bug-gettext
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gettext] ITS


From: Daiki Ueno
Subject: Re: [bug-gettext] ITS
Date: Thu, 01 Oct 2015 19:22:48 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Daiki Ueno <address@hidden> writes:

> http://git.savannah.gnu.org/cgit/gettext.git/log/?h=wip/ueno/its

I think the xgettext implementation is almost there.  Here is a squashed
commit rebased onto the current git master:
http://git.sv.gnu.org/cgit/gettext.git/commit/?h=wip/ueno/its2&id=7a17583f

It now has documentation and tests, and supports "translate",
"localization-notes", "elements-within-text", and "preserve-space" data
categories.

To see the usability of this feature, I tried to convert the existing
XML scanners (namely Glade, GSettings, AppData) to ITS:
http://git.sv.gnu.org/cgit/gettext.git/commit/?h=wip/ueno/its2&id=74751001
http://git.sv.gnu.org/cgit/gettext.git/commit/?h=wip/ueno/its2&id=41185040
http://git.sv.gnu.org/cgit/gettext.git/commit/?h=wip/ueno/its2&id=5c7e88e2

While it was straightforward to rewrite the AppData scanner in ITS, I
realized that the other formats cannot be handled only with ITS 2.0,
because of:

- special whitespace normalization rule in GSettings:
  https://git.gnome.org/browse/glib/tree/gio/gsettingsschema.c#n533

- msgctxt, particularly in the old style format, i.e. "msgctxt|msgid" in
  Glade 2 files

- Glade/GSettings scanners shouldn't escape special characters in XML,
  since the extracted strings are used in the library (GLib/libglade) as
  a ordinary string value, rather than an XML fragment

To work out those issues, I had to add the following new rules:

- gt:preserveSpaceRule, which is same as its:preserveSpaceRule, but it
  allows space="strip" in addition to "preserve" and "default"

- gt:contextRule, which is similar to itst:contextRule used in itstool,
  but it allows textPointer="..." to strip msgctxt part from msgid

- gt:encodeRule, which allows encode="no", to inhibit character escaping

I am not really happy with them.  Any better ideas would be appreciated.

For those interested in testing, I have put the snapshot tarball at:
http://du-a.org/~ueno/gettext/gettext-0.19.6.9-7475.tar.xz

and also prepared a Fedora Copr repository for that (builds will be
added there soon):
http://copr.fedoraproject.org/coprs/ueno/gettext-its/

Regards,
-- 
Daiki Ueno



reply via email to

[Prev in Thread] Current Thread [Next in Thread]