Re: [Tracker] Localization support for tracker

Il giorno lun, 30/10/2006 alle 01.21 +0000, Jamie McCracken ha scritto:
Luca Ferretti wrote:
Il giorno gio, 26/10/2006 alle 10.32 +0200, Luca Ferretti ha scritto:
Following my email on desktop-devel list, here is the updated patch to
add support for translation in tracker.

As Jamie said on desktop-devel list, there are 2 requests to match: 
      * the only component that need l10n is the search tool 

Doh! This is not true. Console tools need also i18n for --help and

I assume its just needed for the --help stuff in the command line tools?

as trackerd is norammly going to be an invisible process I dont think 
this needs i18n?

Do other daemons like gnome-vfs-daemon print out i18n messages?

I would like to avoid i18n in trackerd if possible

thanks anyway for your hard work in this area

Note: Jamie, the patch in the previous mail (that I forgot to send to ml
too) was wrong, due to an accidental NULL removal.

OK, the final patch is attached here. I've just commited on cvs some
needed stuff to apply and test it (po/POTFILES*, po/ChangeLog and
po/it.po). You just have to update your cvs sandbox and apply the
attached patch to test it (more later).

## What the patch does ##

The attached patch will apply some changes to some files, as follow:
      * - Add po directory to SUBDIRS variable, no needs to
        make it conditional, cause the l10n/i18n support is available
        for non-GNOME stuff too.
      * src/tracker-search-tool.c - add N_() and _() macros to enable
        translations, plus change some strings for service selection
        (All file ... Development ... Plain text) for HIG compliance (no
        title capitalization) and homogeneous appearance.
      * src/libtracker/tracker-search.c - Add N_() and _() macros to
        enable translations (--help stuff end error messages), plus some
        changes, i.e
             1. use "THIS" appearance, not "this" for replaceable values
                (for example --service=SERVICE) as should be suggested
                somewhere by GNU coding style. At least this is the
                style used by coreutils (try `ls --help`)
             2. use the first capital letter for error message (for
                example s/no\ results/No\ results); honestly, to match
                GNU coding style[1] we should use "%s: error message\n",
                where %s is the command that was invoked. Are you ok to
                do it?
      * - Most of changes are here. See next section for

## How the l10n support was won ##

The "framework" changes are in
      * add generation of "config.h" file. This is really useful, 'cause
        it's simple to generate and to make available in C source. This
        file is used in l10n to "transport" the TRACKER_LOCALE and
        GETTEXT_PACKAGE definitions. TRACKER_LOCALE is the #define used
        to store the path to locale directory, GETTEXT_PACKAGE is the
        name of .mo file in locale directory. Both those variable are
        generate by the...
      * ... gettext/intltool stuff, that now are out of "if $have_gnome"
        statement. This is needed because l10n is applied to non-GNOME
        stuff too. Here is the ALL_LINGUAS variable where lang codes of
        available translations should be added. NOTE: the recent switch
        from ALL_LINGUAS to po/LINGUAS is GNOME modules was rejected
        here (by now), 'cause this will force us to depend on the latest
      * Finally a couple of cosmetic change to some PKG_CHECK_MODULES to
        make them more readable.

## How add l10n support to executables ##

In short, add 

        bindtextdomain (GETTEXT_PACKAGE, TRACKER_LOCALEDIR);
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
        textdomain (GETTEXT_PACKAGE);
in main(). For a more detailed info, see Biblio.

## What is missing ##

The attached patch will simply add a minimum support. As you can see
only tracker-seach and tracker-search-tool will gain l10n/i18n. All
other stuff is intentionally excluded by now. The framework is here,
ready to be applied to CVS, but there are some stuff to discuss before
translators could start they work:

     1. what we should translate 
     2. how messages should be
IMHO we should translate command line options and error/info message
from command line tools (stuff in src/libtracker/).

The trackerd daemon should provide translations only for command line
option. The log/error/info message should be in C locale, so it will be
more simple for developers track issues. IMHO.

About the style of message, I still have to read the "L10N Guidelines
for Developers": moreover this is stuff for another thread.

More reports and works on it in the next days (or weeks...)

## Testing ##

I like to apply the patch to CVS, so all people can test it (sandboxes
without GNOME, with old auto*, old gettext...). OK to commit?

Meanwhile to test it, update you cvs checkout, apply the patch, rebuild
tracker starting from, install it, then invoke tracked-search
or tracker-search-tool using

        LANG=it LANGUAGE=it_IT tracker-search --help
to see Italian message.

## Biblio ##
* Internationalising GNOME applications
* L10N Guidelines for Developers


Attachment: tracker-l10n.diff
Description: Text Data

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