bug-gettext
[Top][All Lists]
Advanced

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

[bug-gettext] ITS


From: Daiki Ueno
Subject: [bug-gettext] ITS
Date: Wed, 09 Sep 2015 19:10:02 +0900
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Hello,

So, I have just started implementing basic ITS support in gettext.

The current code (still a draft) is now available at:
http://git.savannah.gnu.org/cgit/gettext.git/log/?h=wip/ueno/its

Let me explain a bit more about it, using the polkit example:
http://savannah.gnu.org/bugs/?42615

The upstream project (here, polkit) shall install two files: a .its file
and a .loc file.  The former file shall contain a global ITS rule,
something like:

  <its:rules
    xmlns:its="http://www.w3.org/2005/11/its";
    version="1.0">
    <its:translateRule translate="no" selector="/policyconfig"/>
    <its:translateRule translate="yes"
      selector="/policyconfig/action/description |
                /policyconfig/action/message"/>
    <its:locNoteRule selector="/policyconfig/action/description"
      locNoteType="alert">
      <its:locNote>Hey</its:locNote>
    </its:locNoteRule>
  </its:rules>

The latter file is used to determine which .its file should be used for
an XML document.  It is in the same format as schema locating files used
in nXML mode:
http://www.gnu.org/software/emacs/manual/html_node/nxml-mode/Schema-locating-file-syntax-basics.html#Schema-locating-file-syntax-basics
which looks like:

  <locatingRules xmlns="http://thaiopensource.com/ns/locating-rules/1.0";>
    <uri pattern="*.policy" typeId="polkit"/>
    <documentElement prefix="" localName="policyconfig" typeId="polkit"/>
    <typeId id="polkit" uri="polkit.its"/>
  </locatingRules>

If the --its option is given, xgettext locates those files from
$datadir/gettext/its/{rules,locators}.  For example:

  $ wget 
http://cgit.freedesktop.org/systemd/systemd/tree/src/hostname/org.freedesktop.hostname1.policy.in

  # strip "_" from element names
  $ sed -e 's|<_|<|g' -e 's|</_|</|g' < \
      org.freedesktop.hostname1.policy.in > \
      org.freedesktop.hostname1.policy

  $ xgettext --its --omit-header -o - org.freedesktop.hostname1.policy

produces:

  #. Hey
  #: org.freedesktop.hostname1.policy:20
  msgid "Set host name"
  msgstr ""

  #: org.freedesktop.hostname1.policy:21
  msgid "Authentication is required to set the local host name."
  msgstr ""

  #. Hey
  #: org.freedesktop.hostname1.policy:30
  msgid "Set static host name"
  msgstr ""

  #: org.freedesktop.hostname1.policy:31
  msgid ""
  "Authentication is required to set the statically configured local host name, 
"
  "as well as the pretty host name."
  msgstr ""

  #. Hey
  #: org.freedesktop.hostname1.policy:41
  msgid "Set machine information"
  msgstr ""

  #: org.freedesktop.hostname1.policy:42
  msgid "Authentication is required to set local machine information."
  msgstr ""

At the moment, the implementation lacks many features (and tests), but I
would like to gather opinions before going further.

Comments appreciated!

Regards,
-- 
Daiki Ueno



reply via email to

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