bug-gettext
[Top][All Lists]
Advanced

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

[bug-gettext] [PATCH 0/2] Support Desktop Entry files


From: Daiki Ueno
Subject: [bug-gettext] [PATCH 0/2] Support Desktop Entry files
Date: Fri, 14 Mar 2014 17:42:14 +0900

Hi Javier, and GNOME / KDE friends,

Sorry for the delay.  It took much more time than I originally expected.
The implementation is almost there (patches will follow), although I
still need some input to complete it.

First, let me explain the current status.  Extracting translatable
strings from a .desktop file was rather straightforward.  xgettext can
now create a .po file from a .desktop file, like other file formats.

On the other hand, merging translations back to the .desktop file was
not that easy, because the task does not fit well in the standard
gettext workflow.  So far, I extended msgfmt to handling this.

Here are some questions I need feedbacks:

1. How should we handle lists, for example, values in type "localestring(s)"?

I think there are two options:

a. Let gettext-tools parse them, and treat each element translatable
b. Treat the entire list value as a translatable string

I feel (a) is smarter as it could prevent translation errors, like
missing ';' at the end of line.  However, intltool does (b) and I fear
it might cause translation problems if gettext-tools chose (a).

2. How to specify custom keywords?

If we want to allow custom key with value type "localestring", say
"X-Smiley", we could use --keyword=X-Smiley option of xgettext, but how
about msgfmt?  Another approach is to tell those custom keywords through
comments in a .desktop file.

3. What the ideal command line of msgfmt should be?

Currently it is called like this:

  $ msgfmt --desktop=app.desktop.in -o app.desktop fr.po de.po ...

msgfmt infers the locale name from the filename of each PO file.
However, for other formats, msgfmt offers a flexibility to specify the
locale name, for example:

  $ msgfmt --java --locale fr -o app.desktop fr.po

So, perhaps we should change the above to:

  $ cp app.desktop.in app.desktop
  $ msgfmt --desktop=app.desktop --locale=fr -o app.desktop.tmp fr.po \
    && mv app.desktop.tmp app.desktop
  $ msgfmt --desktop=app.desktop --locale=de -o app.desktop.tmp de.po \
    && mv app.desktop.tmp app.desktop
  ...

However, it will make the Makefile rule (see below) a bit complicated.

4. What the equivalent of @INTLTOOL_DESKTOP_RULE@ should be?

I'm currently thinking something like:

  app.desktop: app.desktop.in
          msgfmt --desktop=$< -o $@ `$(MAKE) -C $(top_builddir)/po 
echo-catalogs`

Any suggestions?

Daiki Ueno (2):
  xgettext: Add support for Desktop Entry files
  msgfmt: Add support for Desktop Entry files

 gettext-tools/src/Makefile.am     |   9 +-
 gettext-tools/src/msgfmt.c        |  36 +++-
 gettext-tools/src/read-desktop.c  | 371 ++++++++++++++++++++++++++++++++++++++
 gettext-tools/src/read-desktop.h  | 111 ++++++++++++
 gettext-tools/src/write-desktop.c | 189 +++++++++++++++++++
 gettext-tools/src/write-desktop.h |  36 ++++
 gettext-tools/src/x-desktop.c     | 126 +++++++++++++
 gettext-tools/src/x-desktop.h     |  47 +++++
 gettext-tools/src/xgettext.c      |   4 +
 9 files changed, 924 insertions(+), 5 deletions(-)
 create mode 100644 gettext-tools/src/read-desktop.c
 create mode 100644 gettext-tools/src/read-desktop.h
 create mode 100644 gettext-tools/src/write-desktop.c
 create mode 100644 gettext-tools/src/write-desktop.h
 create mode 100644 gettext-tools/src/x-desktop.c
 create mode 100644 gettext-tools/src/x-desktop.h

-- 
1.8.4.2




reply via email to

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