gettext.info-6   [plain text]


Dies ist gettext.info, hergestellt von Makeinfo Version 4.3 aus
gettext.texi.

INFO-DIR-SECTION GNU Gettext Utilities
START-INFO-DIR-ENTRY
* gettext: (gettext).                          GNU gettext utilities.
* autopoint: (gettext)autopoint Invocation.    Copy gettext infrastructure.
* gettextize: (gettext)gettextize Invocation.  Prepare a package for gettext.
* msgattrib: (gettext)msgattrib Invocation.    Select part of a PO file.
* msgcat: (gettext)msgcat Invocation.          Combine several PO files.
* msgcmp: (gettext)msgcmp Invocation.          Compare a PO file and template.
* msgcomm: (gettext)msgcomm Invocation.        Match two PO files.
* msgconv: (gettext)msgconv Invocation.        Convert PO file to encoding.
* msgen: (gettext)msgen Invocation.            Create an English PO file.
* msgexec: (gettext)msgexec Invocation.        Process a PO file.
* msgfilter: (gettext)msgfilter Invocation.    Pipe a PO file through a filter.
* msgfmt: (gettext)msgfmt Invocation.          Make MO files out of PO files.
* msggrep: (gettext)msggrep Invocation.        Select part of a PO file.
* msginit: (gettext)msginit Invocation.        Create a fresh PO file.
* msgmerge: (gettext)msgmerge Invocation.      Update a PO file from template.
* msgunfmt: (gettext)msgunfmt Invocation.      Uncompile MO file into PO file.
* msguniq: (gettext)msguniq Invocation.        Unify duplicates for PO file.
* xgettext: (gettext)xgettext Invocation.      Extract strings into a PO file.
* ISO639: (gettext)Language Codes.             ISO 639 language codes.
* ISO3166: (gettext)Country Codes.             ISO 3166 country codes.
END-INFO-DIR-ENTRY

   This file provides documentation for GNU `gettext' utilities.  It
also serves as a reference for the free Translation Project.

   Copyright (C) 1995-1998, 2001-2003 Free Software Foundation, Inc.

   Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

   Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided that
the entire resulting derived work is distributed under the terms of a
permission notice identical to this one.

   Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be stated in a
translation approved by the Foundation.


File: gettext.info,  Node: Plural forms,  Next: GUI program problems,  Prev: Charset conversion,  Up: gettext

Additional functions for plural forms
-------------------------------------

   The functions of the `gettext' family described so far (and all the
`catgets' functions as well) have one problem in the real world which
have been neglected completely in all existing approaches.  What is
meant here is the handling of plural forms.

   Looking through Unix source code before the time anybody thought
about internationalization (and, sadly, even afterwards) one can often
find code similar to the following:

        printf ("%d file%s deleted", n, n == 1 ? "" : "s");

After the first complaints from people internationalizing the code
people either completely avoided formulations like this or used strings
like `"file(s)"'.  Both look unnatural and should be avoided.  First
tries to solve the problem correctly looked like this:

        if (n == 1)
          printf ("%d file deleted", n);
        else
          printf ("%d files deleted", n);

   But this does not solve the problem.  It helps languages where the
plural form of a noun is not simply constructed by adding an `s' but
that is all.  Once again people fell into the trap of believing the
rules their language is using are universal.  But the handling of plural
forms differs widely between the language families.  For example, Rafal
Maszkowski `<rzm@mat.uni.torun.pl>' reports:

     In Polish we use e.g. plik (file) this way:
          1 plik
          2,3,4 pliki
          5-21 pliko'w
          22-24 pliki
          25-31 pliko'w
     and so on (o' means 8859-2 oacute which should be rather okreska,
     similar to aogonek).

   There are two things which can differ between languages (and even
inside language families);

   * The form how plural forms are built differs.  This is a problem
     with languages which have many irregularities.  German, for
     instance, is a drastic case.  Though English and German are part
     of the same language family (Germanic), the almost regular forming
     of plural noun forms (appending an `s') is hardly found in German.

   * The number of plural forms differ.  This is somewhat surprising for
     those who only have experiences with Romanic and Germanic languages
     since here the number is the same (there are two).

     But other language families have only one form or many forms.  More
     information on this in an extra section.

   The consequence of this is that application writers should not try to
solve the problem in their code.  This would be localization since it is
only usable for certain, hardcoded language environments.  Instead the
extended `gettext' interface should be used.

   These extra functions are taking instead of the one key string two
strings and a numerical argument.  The idea behind this is that using
the numerical argument and the first string as a key, the implementation
can select using rules specified by the translator the right plural
form.  The two string arguments then will be used to provide a return
value in case no message catalog is found (similar to the normal
`gettext' behavior).  In this case the rules for Germanic language is
used and it is assumed that the first string argument is the singular
form, the second the plural form.

   This has the consequence that programs without language catalogs can
display the correct strings only if the program itself is written using
a Germanic language.  This is a limitation but since the GNU C library
(as well as the GNU `gettext' package) are written as part of the GNU
package and the coding standards for the GNU project require program
being written in English, this solution nevertheless fulfills its
purpose.

 - Funktion: char * ngettext (const char *MSGID1, const char *MSGID2,
          unsigned long int N)
     The `ngettext' function is similar to the `gettext' function as it
     finds the message catalogs in the same way.  But it takes two
     extra arguments.  The MSGID1 parameter must contain the singular
     form of the string to be converted.  It is also used as the key
     for the search in the catalog.  The MSGID2 parameter is the plural
     form.  The parameter N is used to determine the plural form.  If no
     message catalog is found MSGID1 is returned if `n == 1', otherwise
     `msgid2'.

     An example for the use of this function is:

          printf (ngettext ("%d file removed", "%d files removed", n), n);

     Please note that the numeric value N has to be passed to the
     `printf' function as well.  It is not sufficient to pass it only to
     `ngettext'.

 - Funktion: char * dngettext (const char *DOMAIN, const char *MSGID1,
          const char *MSGID2, unsigned long int N)
     The `dngettext' is similar to the `dgettext' function in the way
     the message catalog is selected.  The difference is that it takes
     two extra parameter to provide the correct plural form.  These two
     parameters are handled in the same way `ngettext' handles them.

 - Funktion: char * dcngettext (const char *DOMAIN, const char *MSGID1,
          const char *MSGID2, unsigned long int N, int CATEGORY)
     The `dcngettext' is similar to the `dcgettext' function in the way
     the message catalog is selected.  The difference is that it takes
     two extra parameter to provide the correct plural form.  These two
     parameters are handled in the same way `ngettext' handles them.

   Now, how do these functions solve the problem of the plural forms?
Without the input of linguists (which was not available) it was not
possible to determine whether there are only a few different forms in
which plural forms are formed or whether the number can increase with
every new supported language.

   Therefore the solution implemented is to allow the translator to
specify the rules of how to select the plural form.  Since the formula
varies with every language this is the only viable solution except for
hardcoding the information in the code (which still would require the
possibility of extensions to not prevent the use of new languages).

   The information about the plural form selection has to be stored in
the header entry of the PO file (the one with the empty `msgid' string).
The plural form information looks like this:

     Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;

   The `nplurals' value must be a decimal number which specifies how
many different plural forms exist for this language.  The string
following `plural' is an expression which is using the C language
syntax.  Exceptions are that no negative numbers are allowed, numbers
must be decimal, and the only variable allowed is `n'.  This expression
will be evaluated whenever one of the functions `ngettext',
`dngettext', or `dcngettext' is called.  The numeric value passed to
these functions is then substituted for all uses of the variable `n' in
the expression.  The resulting value then must be greater or equal to
zero and smaller than the value given as the value of `nplurals'.

The following rules are known at this point.  The language with families
are listed.  But this does not necessarily mean the information can be
generalized for the whole family (as can be easily seen in the table
below).(1)

Only one form:
     Some languages only require one single form.  There is no
     distinction between the singular and plural form.  An appropriate
     header entry would look like this:

          Plural-Forms: nplurals=1; plural=0;

     Languages with this property include:

    Finno-Ugric family
          Hungarian

    Asian family
          Japanese, Korean

    Turkic/Altaic family
          Turkish

Two forms, singular used for one only
     This is the form used in most existing programs since it is what
     English is using.  A header entry would look like this:

          Plural-Forms: nplurals=2; plural=n != 1;

     (Note: this uses the feature of C expressions that boolean
     expressions have to value zero or one.)

     Languages with this property include:

    Germanic family
          Danish, Dutch, English, Faroese, German, Norwegian, Swedish

    Finno-Ugric family
          Estonian, Finnish

    Latin/Greek family
          Greek

    Semitic family
          Hebrew

    Romanic family
          Italian, Portuguese, Spanish

    Artificial
          Esperanto

Two forms, singular used for zero and one
     Exceptional case in the language family.  The header entry would
     be:

          Plural-Forms: nplurals=2; plural=n>1;

     Languages with this property include:

    Romanic family
          French, Brazilian Portuguese

Three forms, special case for zero
     The header entry would be:

          Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;

     Languages with this property include:

    Baltic family
          Latvian

Three forms, special cases for one and two
     The header entry would be:

          Plural-Forms: nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2;

     Languages with this property include:

    Celtic
          Gaeilge (Irish)

Three forms, special case for numbers ending in 1[2-9]
     The header entry would look like this:

          Plural-Forms: nplurals=3; \
              plural=n%10==1 && n%100!=11 ? 0 : \
                     n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2;

     Languages with this property include:

    Baltic family
          Lithuanian

Three forms, special cases for numbers ending in 1 and 2, 3, 4, except those ending in 1[1-4]
     The header entry would look like this:

          Plural-Forms: nplurals=3; \
              plural=n%10==1 && n%100!=11 ? 0 : \
                     n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;

     Languages with this property include:

    Slavic family
          Croatian, Czech, Russian, Ukrainian

Three forms, special cases for 1 and 2, 3, 4
     The header entry would look like this:

          Plural-Forms: nplurals=3; \
              plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;

     Languages with this property include:

    Slavic family
          Slovak

Three forms, special case for one and some numbers ending in 2, 3, or 4
     The header entry would look like this:

          Plural-Forms: nplurals=3; \
              plural=n==1 ? 0 : \
                     n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;

     Languages with this property include:

    Slavic family
          Polish

Four forms, special case for one and all numbers ending in 02, 03, or 04
     The header entry would look like this:

          Plural-Forms: nplurals=4; \
              plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;

     Languages with this property include:

    Slavic family
          Slovenian

   ---------- Footnotes ----------

   (1) Additions are welcome.  Send appropriate information to
<bug-glibc-manual@gnu.org>.


File: gettext.info,  Node: GUI program problems,  Next: Optimized gettext,  Prev: Plural forms,  Up: gettext

How to use `gettext' in GUI programs
------------------------------------

   One place where the `gettext' functions, if used normally, have big
problems is within programs with graphical user interfaces (GUIs).  The
problem is that many of the strings which have to be translated are very
short.  They have to appear in pull-down menus which restricts the
length.  But strings which are not containing entire sentences or at
least large fragments of a sentence may appear in more than one
situation in the program but might have different translations.  This is
especially true for the one-word strings which are frequently used in
GUI programs.

   As a consequence many people say that the `gettext' approach is
wrong and instead `catgets' should be used which indeed does not have
this problem.  But there is a very simple and powerful method to handle
these kind of problems with the `gettext' functions.

As as example consider the following fictional situation.  A GUI program
has a menu bar with the following entries:

     +------------+------------+--------------------------------------+
     | File       | Printer    |                                      |
     +------------+------------+--------------------------------------+
     | Open     | | Select   |
     | New      | | Open     |
     +----------+ | Connect  |
                  +----------+

   To have the strings `File', `Printer', `Open', `New', `Select', and
`Connect' translated there has to be at some point in the code a call
to a function of the `gettext' family.  But in two places the string
passed into the function would be `Open'.  The translations might not
be the same and therefore we are in the dilemma described above.

   One solution to this problem is to artificially enlengthen the
strings to make them unambiguous.  But what would the program do if no
translation is available?  The enlengthened string is not what should be
printed.  So we should use a little bit modified version of the
functions.

   To enlengthen the strings a uniform method should be used.  E.g., in
the example above the strings could be chosen as

     Menu|File
     Menu|Printer
     Menu|File|Open
     Menu|File|New
     Menu|Printer|Select
     Menu|Printer|Open
     Menu|Printer|Connect

   Now all the strings are different and if now instead of `gettext'
the following little wrapper function is used, everything works just
fine:

       char *
       sgettext (const char *msgid)
       {
         char *msgval = gettext (msgid);
         if (msgval == msgid)
           msgval = strrchr (msgid, '|') + 1;
         return msgval;
       }

   What this little function does is to recognize the case when no
translation is available.  This can be done very efficiently by a
pointer comparison since the return value is the input value.  If there
is no translation we know that the input string is in the format we used
for the Menu entries and therefore contains a `|' character.  We simply
search for the last occurrence of this character and return a pointer
to the character following it.  That's it!

   If one now consistently uses the enlengthened string form and
replaces the `gettext' calls with calls to `sgettext' (this is normally
limited to very few places in the GUI implementation) then it is
possible to produce a program which can be internationalized.

   The other `gettext' functions (`dgettext', `dcgettext' and the
`ngettext' equivalents) can and should have corresponding functions as
well which look almost identical, except for the parameters and the
call to the underlying function.

   Now there is of course the question why such functions do not exist
in the GNU gettext package?  There are two parts of the answer to this
question.

   * They are easy to write and therefore can be provided by the
     project they are used in.  This is not an answer by itself and
     must be seen together with the second part which is:

   * There is no way the gettext package can contain a version which
     can work everywhere.  The problem is the selection of the
     character to separate the prefix from the actual string in the
     enlenghtened string.  The examples above used `|' which is a quite
     good choice because it resembles a notation frequently used in
     this context and it also is a character not often used in message
     strings.

     But what if the character is used in message strings?  Or if the
     chose character is not available in the character set on the
     machine one compiles (e.g., `|' is not required to exist for
     ISO C; this is why the `iso646.h' file exists in ISO C programming
     environments).

   There is only one more comment to be said.  The wrapper function
above requires that the translations strings are not enlengthened
themselves.  This is only logical.  There is no need to disambiguate
the strings (since they are never used as keys for a search) and one
also saves quite some memory and disk space by doing this.


File: gettext.info,  Node: Optimized gettext,  Prev: GUI program problems,  Up: gettext

Optimization of the *gettext functions
--------------------------------------

   At this point of the discussion we should talk about an advantage of
the GNU `gettext' implementation.  Some readers might have pointed out
that an internationalized program might have a poor performance if some
string has to be translated in an inner loop.  While this is unavoidable
when the string varies from one run of the loop to the other it is
simply a waste of time when the string is always the same.  Take the
following example:

     {
       while (...)
         {
           puts (gettext ("Hello world"));
         }
     }

When the locale selection does not change between two runs the resulting
string is always the same.  One way to use this is:

     {
       str = gettext ("Hello world");
       while (...)
         {
           puts (str);
         }
     }

But this solution is not usable in all situation (e.g. when the locale
selection changes) nor does it lead to legible code.

   For this reason, GNU `gettext' caches previous translation results.
When the same translation is requested twice, with no new message
catalogs being loaded in between, `gettext' will, the second time, find
the result through a single cache lookup.


File: gettext.info,  Node: Comparison,  Next: Using libintl.a,  Prev: gettext,  Up: Programmers

Comparing the Two Interfaces
============================

   The following discussion is perhaps a little bit colored.  As said
above we implemented GNU `gettext' following the Uniforum proposal and
this surely has its reasons.  But it should show how we came to this
decision.

   First we take a look at the developing process.  When we write an
application using NLS provided by `gettext' we proceed as always.  Only
when we come to a string which might be seen by the users and thus has
to be translated we use `gettext("...")' instead of `"..."'.  At the
beginning of each source file (or in a central header file) we define

     #define gettext(String) (String)

   Even this definition can be avoided when the system supports the
`gettext' function in its C library.  When we compile this code the
result is the same as if no NLS code is used.  When  you take a look at
the GNU `gettext' code you will see that we use `_("...")' instead of
`gettext("...")'.  This reduces the number of additional characters per
translatable string to _3_ (in words: three).

   When now a production version of the program is needed we simply
replace the definition

     #define _(String) (String)

by

     #include <libintl.h>
     #define _(String) gettext (String)

Additionally we run the program `xgettext' on all source code file
which contain translatable strings and that's it: we have a running
program which does not depend on translations to be available, but which
can use any that becomes available.

   The same procedure can be done for the `gettext_noop' invocations
(*note Special cases::).  One usually defines `gettext_noop' as a no-op
macro.  So you should consider the following code for your project:

     #define gettext_noop(String) String
     #define N_(String) gettext_noop (String)

   `N_' is a short form similar to `_'.  The `Makefile' in the `po/'
directory of GNU `gettext' knows by default both of the mentioned short
forms so you are invited to follow this proposal for your own ease.

   Now to `catgets'.  The main problem is the work for the programmer.
Every time he comes to a translatable string he has to define a number
(or a symbolic constant) which has also be defined in the message
catalog file.  He also has to take care for duplicate entries,
duplicate message IDs etc.  If he wants to have the same quality in the
message catalog as the GNU `gettext' program provides he also has to
put the descriptive comments for the strings and the location in all
source code files in the message catalog.  This is nearly a Mission:
Impossible.

   But there are also some points people might call advantages speaking
for `catgets'.  If you have a single word in a string and this string
is used in different contexts it is likely that in one or the other
language the word has different translations.  Example:

     printf ("%s: %d", gettext ("number"), number_of_errors)
     
     printf ("you should see %d %s", number_count,
             number_count == 1 ? gettext ("number") : gettext ("numbers"))

   Here we have to translate two times the string `"number"'.  Even if
you do not speak a language beside English it might be possible to
recognize that the two words have a different meaning.  In German the
first appearance has to be translated to `"Anzahl"' and the second to
`"Zahl"'.

   Now you can say that this example is really esoteric.  And you are
right!  This is exactly how we felt about this problem and decide that
it does not weight that much.  The solution for the above problem could
be very easy:

     printf ("%s %d", gettext ("number:"), number_of_errors)
     
     printf (number_count == 1 ? gettext ("you should see %d number")
                               : gettext ("you should see %d numbers"),
             number_count)

   We believe that we can solve all conflicts with this method.  If it
is difficult one can also consider changing one of the conflicting
string a little bit.  But it is not impossible to overcome.

   `catgets' allows same original entry to have different translations,
but `gettext' has another, scalable approach for solving ambiguities of
this kind: *Note Ambiguities::.


File: gettext.info,  Node: Using libintl.a,  Next: gettext grok,  Prev: Comparison,  Up: Programmers

Using libintl.a in own programs
===============================

   Starting with version 0.9.4 the library `libintl.h' should be
self-contained.  I.e., you can use it in your own programs without
providing additional functions.  The `Makefile' will put the header and
the library in directories selected using the `$(prefix)'.


File: gettext.info,  Node: gettext grok,  Next: Temp Programmers,  Prev: Using libintl.a,  Up: Programmers

Being a `gettext' grok
======================

   To fully exploit the functionality of the GNU `gettext' library it
is surely helpful to read the source code.  But for those who don't want
to spend that much time in reading the (sometimes complicated) code here
is a list comments:

   * Changing the language at runtime

     For interactive programs it might be useful to offer a selection
     of the used language at runtime.  To understand how to do this one
     need to know how the used language is determined while executing
     the `gettext' function.  The method which is presented here only
     works correctly with the GNU implementation of the `gettext'
     functions.

     In the function `dcgettext' at every call the current setting of
     the highest priority environment variable is determined and used.
     Highest priority means here the following list with decreasing
     priority:

       1. `LANGUAGE'

       2. `LC_ALL'

       3. `LC_xxx', according to selected locale

       4. `LANG'

     Afterwards the path is constructed using the found value and the
     translation file is loaded if available.

     What happens now when the value for, say, `LANGUAGE' changes?
     According to the process explained above the new value of this
     variable is found as soon as the `dcgettext' function is called.
     But this also means the (perhaps) different message catalog file
     is loaded.  In other words: the used language is changed.

     But there is one little hook.  The code for gcc-2.7.0 and up
     provides some optimization.  This optimization normally prevents
     the calling of the `dcgettext' function as long as no new catalog
     is loaded.  But if `dcgettext' is not called the program also
     cannot find the `LANGUAGE' variable be changed (*note Optimized
     gettext::).  A solution for this is very easy.  Include the
     following code in the language switching function.

            /* Change language.  */
            setenv ("LANGUAGE", "fr", 1);
          
            /* Make change known.  */
            {
              extern int  _nl_msg_cat_cntr;
              ++_nl_msg_cat_cntr;
            }

     The variable `_nl_msg_cat_cntr' is defined in `loadmsgcat.c'.  You
     don't need to know what this is for.  But it can be used to detect
     whether a `gettext' implementation is GNU gettext and not non-GNU
     system's native gettext implementation.



File: gettext.info,  Node: Temp Programmers,  Prev: gettext grok,  Up: Programmers

Temporary Notes for the Programmers Chapter
===========================================

* Menu:

* Temp Implementations::        Temporary - Two Possible Implementations
* Temp catgets::                Temporary - About `catgets'
* Temp WSI::                    Temporary - Why a single implementation
* Temp Notes::                  Temporary - Notes


File: gettext.info,  Node: Temp Implementations,  Next: Temp catgets,  Prev: Temp Programmers,  Up: Temp Programmers

Temporary - Two Possible Implementations
----------------------------------------

   There are two competing methods for language independent messages:
the X/Open `catgets' method, and the Uniforum `gettext' method.  The
`catgets' method indexes messages by integers; the `gettext' method
indexes them by their English translations.  The `catgets' method has
been around longer and is supported by more vendors.  The `gettext'
method is supported by Sun, and it has been heard that the COSE
multi-vendor initiative is supporting it.  Neither method is a POSIX
standard; the POSIX.1 committee had a lot of disagreement in this area.

   Neither one is in the POSIX standard.  There was much disagreement
in the POSIX.1 committee about using the `gettext' routines vs.
`catgets' (XPG).  In the end the committee couldn't agree on anything,
so no messaging system was included as part of the standard.  I believe
the informative annex of the standard includes the XPG3 messaging
interfaces, "...as an example of a messaging system that has been
implemented..."

   They were very careful not to say anywhere that you should use one
set of interfaces over the other.  For more on this topic please see
the Programming for Internationalization FAQ.


File: gettext.info,  Node: Temp catgets,  Next: Temp WSI,  Prev: Temp Implementations,  Up: Temp Programmers

Temporary - About `catgets'
---------------------------

   There have been a few discussions of late on the use of `catgets' as
a base.  I think it important to present both sides of the argument and
hence am opting to play devil's advocate for a little bit.

   I'll not deny the fact that `catgets' could have been designed a lot
better.  It currently has quite a number of limitations and these have
already been pointed out.

   However there is a great deal to be said for consistency and
standardization.  A common recurring problem when writing Unix software
is the myriad portability problems across Unix platforms.  It seems as
if every Unix vendor had a look at the operating system and found parts
they could improve upon.  Undoubtedly, these modifications are probably
innovative and solve real problems.  However, software developers have
a hard time keeping up with all these changes across so many platforms.

   And this has prompted the Unix vendors to begin to standardize their
systems.  Hence the impetus for Spec1170.  Every major Unix vendor has
committed to supporting this standard and every Unix software developer
waits with glee the day they can write software to this standard and
simply recompile (without having to use autoconf) across different
platforms.

   As I understand it, Spec1170 is roughly based upon version 4 of the
X/Open Portability Guidelines (XPG4).  Because `catgets' and friends
are defined in XPG4, I'm led to believe that `catgets' is a part of
Spec1170 and hence will become a standardized component of all Unix
systems.


File: gettext.info,  Node: Temp WSI,  Next: Temp Notes,  Prev: Temp catgets,  Up: Temp Programmers

Temporary - Why a single implementation
---------------------------------------

   Now it seems kind of wasteful to me to have two different systems
installed for accessing message catalogs.  If we do want to remedy
`catgets' deficiencies why don't we try to expand `catgets' (in a
compatible manner) rather than implement an entirely new system.
Otherwise, we'll end up with two message catalog access systems
installed with an operating system - one set of routines for packages
using GNU `gettext' for their internationalization, and another set of
routines (catgets) for all other software.  Bloated?

   Supposing another catalog access system is implemented.  Which do we
recommend?  At least for Linux, we need to attract as many software
developers as possible.  Hence we need to make it as easy for them to
port their software as possible.  Which means supporting `catgets'.  We
will be implementing the `libintl' code within our `libc', but does
this mean we also have to incorporate another message catalog access
scheme within our `libc' as well?  And what about people who are going
to be using the `libintl' + non-`catgets' routines.  When they port
their software to other platforms, they're now going to have to include
the front-end (`libintl') code plus the back-end code (the non-`catgets'
access routines) with their software instead of just including the
`libintl' code with their software.

   Message catalog support is however only the tip of the iceberg.
What about the data for the other locale categories.  They also have a
number of deficiencies.  Are we going to abandon them as well and
develop another duplicate set of routines (should `libintl' expand
beyond message catalog support)?

   Like many parts of Unix that can be improved upon, we're stuck with
balancing compatibility with the past with useful improvements and
innovations for the future.


File: gettext.info,  Node: Temp Notes,  Prev: Temp WSI,  Up: Temp Programmers

Temporary - Notes
-----------------

   X/Open agreed very late on the standard form so that many
implementations differ from the final form.  Both of my system (old
Linux catgets and Ultrix-4) have a strange variation.

   OK.  After incorporating the last changes I have to spend some time
on making the GNU/Linux `libc' `gettext' functions.  So in future
Solaris is not the only system having `gettext'.


File: gettext.info,  Node: Translators,  Next: Maintainers,  Prev: Programmers,  Up: Top

The Translator's View
*********************

* Menu:

* Trans Intro 0::               Introduction 0
* Trans Intro 1::               Introduction 1
* Discussions::                 Discussions
* Organization::                Organization
* Information Flow::            Information Flow
* Prioritizing messages::       How to find which messages to translate first


File: gettext.info,  Node: Trans Intro 0,  Next: Trans Intro 1,  Prev: Translators,  Up: Translators

Introduction 0
==============

   Free software is going international!  The Translation Project is a
way to get maintainers, translators and users all together, so free
software will gradually become able to speak many native languages.

   The GNU `gettext' tool set contains _everything_ maintainers need
for internationalizing their packages for messages.  It also contains
quite useful tools for helping translators at localizing messages to
their native language, once a package has already been
internationalized.

   To achieve the Translation Project, we need many interested people
who like their own language and write it well, and who are also able to
synergize with other translators speaking the same language.  If you'd
like to volunteer to _work_ at translating messages, please send mail
to your translating team.

   Each team has its own mailing list, courtesy of Linux International.
You may reach your translating team at the address `LL@li.org',
replacing LL by the two-letter ISO 639 code for your language.
Language codes are _not_ the same as country codes given in ISO 3166.
The following translating teams exist:

     Chinese `zh', Czech `cs', Danish `da', Dutch `nl', Esperanto `eo',
     Finnish `fi', French `fr', Irish `ga', German `de', Greek `el',
     Italian `it', Japanese `ja', Indonesian `in', Norwegian `no',
     Polish `pl', Portuguese `pt', Russian `ru', Spanish `es', Swedish
     `sv' and Turkish `tr'.

For example, you may reach the Chinese translating team by writing to
`zh@li.org'.  When you become a member of the translating team for your
own language, you may subscribe to its list.  For example, Swedish
people can send a message to `sv-request@li.org', having this message
body:

     subscribe

   Keep in mind that team members should be interested in _working_ at
translations, or at solving translational difficulties, rather than
merely lurking around.  If your team does not exist yet and you want to
start one, please write to `translation@iro.umontreal.ca'; you will
then reach the coordinator for all translator teams.

   A handful of GNU packages have already been adapted and provided
with message translations for several languages.  Translation teams
have begun to organize, using these packages as a starting point.  But
there are many more packages and many languages for which we have no
volunteer translators.  If you would like to volunteer to work at
translating messages, please send mail to
`translation@iro.umontreal.ca' indicating what language(s) you can work
on.


File: gettext.info,  Node: Trans Intro 1,  Next: Discussions,  Prev: Trans Intro 0,  Up: Translators

Introduction 1
==============

   This is now official, GNU is going international!  Here is the
announcement submitted for the January 1995 GNU Bulletin:

     A handful of GNU packages have already been adapted and provided
     with message translations for several languages.  Translation
     teams have begun to organize, using these packages as a starting
     point.  But there are many more packages and many languages for
     which we have no volunteer translators.  If you'd like to
     volunteer to work at translating messages, please send mail to
     `translation@iro.umontreal.ca' indicating what language(s) you can
     work on.

   This document should answer many questions for those who are curious
about the process or would like to contribute.  Please at least skim
over it, hoping to cut down a little of the high volume of e-mail
generated by this collective effort towards internationalization of
free software.

   Most free programming which is widely shared is done in English, and
currently, English is used as the main communicating language between
national communities collaborating to free software.  This very document
is written in English.  This will not change in the foreseeable future.

   However, there is a strong appetite from national communities for
having more software able to write using national language and habits,
and there is an on-going effort to modify free software in such a way
that it becomes able to do so.  The experiments driven so far raised an
enthusiastic response from pretesters, so we believe that
internationalization of free software is dedicated to succeed.

   For suggestion clarifications, additions or corrections to this
document, please e-mail to `translation@iro.umontreal.ca'.


File: gettext.info,  Node: Discussions,  Next: Organization,  Prev: Trans Intro 1,  Up: Translators

Discussions
===========

   Facing this internationalization effort, a few users expressed their
concerns.  Some of these doubts are presented and discussed, here.

   * Smaller groups

     Some languages are not spoken by a very large number of people, so
     people speaking them sometimes consider that there may not be all
     that much demand such versions of free software packages.
     Moreover, many people being _into computers_, in some countries,
     generally seem to prefer English versions of their software.

     On the other end, people might enjoy their own language a lot, and
     be very motivated at providing to themselves the pleasure of
     having their beloved free software speaking their mother tongue.
     They do themselves a personal favor, and do not pay that much
     attention to the number of people benefiting of their work.

   * Misinterpretation

     Other users are shy to push forward their own language, seeing in
     this some kind of misplaced propaganda.  Someone thought there
     must be some users of the language over the networks pestering
     other people with it.

     But any spoken language is worth localization, because there are
     people behind the language for whom the language is important and
     dear to their hearts.

   * Odd translations

     The biggest problem is to find the right translations so that
     everybody can understand the messages.  Translations are usually a
     little odd.  Some people get used to English, to the extent they
     may find translations into their own language "rather pushy,
     obnoxious and sometimes even hilarious."  As a French speaking
     man, I have the experience of those instruction manuals for goods,
     so poorly translated in French in Korea or Taiwan...

     The fact is that we sometimes have to create a kind of national
     computer culture, and this is not easy without the collaboration of
     many people liking their mother tongue.  This is why translations
     are better achieved by people knowing and loving their own
     language, and ready to work together at improving the results they
     obtain.

   * Dependencies over the GPL or LGPL

     Some people wonder if using GNU `gettext' necessarily brings their
     package under the protective wing of the GNU General Public
     License or the GNU Library General Public License, when they do
     not want to make their program free, or want other kinds of
     freedom.  The simplest answer is "normally not".

     The `gettext-runtime' part of GNU `gettext', i.e. the contents of
     `libintl', is covered by the GNU Library General Public License.
     The `gettext-tools' part of GNU `gettext', i.e. the rest of the
     GNU `gettext' package, is covered by the GNU General Public
     License.

     The mere marking of localizable strings in a package, or
     conditional inclusion of a few lines for initialization, is not
     really including GPL'ed or LGPL'ed code.  However, since the
     localization routines in `libintl' are under the LGPL, the LGPL
     needs to be considered.  It gives the right to distribute the
     complete unmodified source of `libintl' even with non-free
     programs.  It also gives the right to use `libintl' as a shared
     library, even for non-free programs.  But it gives the right to
     use `libintl' as a static library or to incorporate `libintl' into
     another library only to free software.



File: gettext.info,  Node: Organization,  Next: Information Flow,  Prev: Discussions,  Up: Translators

Organization
============

   On a larger scale, the true solution would be to organize some kind
of fairly precise set up in which volunteers could participate.  I gave
some thought to this idea lately, and realize there will be some touchy
points.  I thought of writing to Richard Stallman to launch such a
project, but feel it might be good to shake out the ideas between
ourselves first.  Most probably that Linux International has some
experience in the field already, or would like to orchestrate the
volunteer work, maybe.  Food for thought, in any case!

   I guess we have to setup something early, somehow, that will help
many possible contributors of the same language to interlock and avoid
work duplication, and further be put in contact for solving together
problems particular to their tongue (in most languages, there are many
difficulties peculiar to translating technical English).  My Swedish
contributor acknowledged these difficulties, and I'm well aware of them
for French.

   This is surely not a technical issue, but we should manage so the
effort of locale contributors be maximally useful, despite the national
team layer interface between contributors and maintainers.

   The Translation Project needs some setup for coordinating language
coordinators.  Localizing evolving programs will surely become a
permanent and continuous activity in the free software community, once
well started.  The setup should be minimally completed and tested
before GNU `gettext' becomes an official reality.  The e-mail address
`translation@iro.umontreal.ca' has been setup for receiving offers from
volunteers and general e-mail on these topics.  This address reaches
the Translation Project coordinator.

* Menu:

* Central Coordination::        Central Coordination
* National Teams::              National Teams
* Mailing Lists::               Mailing Lists


File: gettext.info,  Node: Central Coordination,  Next: National Teams,  Prev: Organization,  Up: Organization

Central Coordination
--------------------

   I also think GNU will need sooner than it thinks, that someone setup
a way to organize and coordinate these groups.  Some kind of group of
groups.  My opinion is that it would be good that GNU delegates this
task to a small group of collaborating volunteers, shortly.  Perhaps in
`gnu.announce' a list of this national committee's can be published.

   My role as coordinator would simply be to refer to Ulrich any German
speaking volunteer interested to localization of free software
packages, and maybe helping national groups to initially organize,
while maintaining national registries for until national groups are
ready to take over.  In fact, the coordinator should ease volunteers to
get in contact with one another for creating national teams, which
should then select one coordinator per language, or country
(regionalized language).  If well done, the coordination should be
useful without being an overwhelming task, the time to put delegations
in place.


File: gettext.info,  Node: National Teams,  Next: Mailing Lists,  Prev: Central Coordination,  Up: Organization

National Teams
--------------

   I suggest we look for volunteer coordinators/editors for individual
languages.  These people will scan contributions of translation files
for various programs, for their own languages, and will ensure high and
uniform standards of diction.

   From my current experience with other people in these days, those who
provide localizations are very enthusiastic about the process, and are
more interested in the localization process than in the program they
localize, and want to do many programs, not just one.  This seems to
confirm that having a coordinator/editor for each language is a good
idea.

   We need to choose someone who is good at writing clear and concise
prose in the language in question.  That is hard--we can't check it
ourselves.  So we need to ask a few people to judge each others'
writing and select the one who is best.

   I announce my prerelease to a few dozen people, and you would not
believe all the discussions it generated already.  I shudder to think
what will happen when this will be launched, for true, officially,
world wide.  Who am I to arbitrate between two Czekolsovak users
contradicting each other, for example?

   I assume that your German is not much better than my French so that
I would not be able to judge about these formulations.  What I would
suggest is that for each language there is a group for people who
maintain the PO files and judge about changes.  I suspect there will be
cultural differences between how such groups of people will behave.
Some will have relaxed ways, reach consensus easily, and have anyone of
the group relate to the maintainers, while others will fight to death,
organize heavy administrations up to national standards, and use strict
channels.

   The German team is putting out a good example.  Right now, they are
maybe half a dozen people revising translations of each other and
discussing the linguistic issues.  I do not even have all the names.
Ulrich Drepper is taking care of coordinating the German team.  He
subscribed to all my pretest lists, so I do not even have to warn him
specifically of incoming releases.

   I'm sure, that is a good idea to get teams for each language working
on translations.  That will make the translations better and more
consistent.

* Menu:

* Sub-Cultures::                Sub-Cultures
* Organizational Ideas::        Organizational Ideas


File: gettext.info,  Node: Sub-Cultures,  Next: Organizational Ideas,  Prev: National Teams,  Up: National Teams

Sub-Cultures
............

   Taking French for example, there are a few sub-cultures around
computers which developed diverging vocabularies.  Picking volunteers
here and there without addressing this problem in an organized way,
soon in the project, might produce a distasteful mix of
internationalized programs, and possibly trigger endless quarrels among
those who really care.

   Keeping some kind of unity in the way French localization of
internationalized programs is achieved is a difficult (and delicate)
job.  Knowing the latin character of French people (:-), if we take this
the wrong way, we could end up nowhere, or spoil a lot of energies.
Maybe we should begin to address this problem seriously _before_ GNU
`gettext' become officially published.  And I suspect that this means
soon!


File: gettext.info,  Node: Organizational Ideas,  Prev: Sub-Cultures,  Up: National Teams

Organizational Ideas
....................

   I expect the next big changes after the official release.  Please
note that I use the German translation of the short GPL message.  We
need to set a few good examples before the localization goes out for
true in the free software community.  Here are a few points to discuss:

   * Each group should have one FTP server (at least one master).

   * The files on the server should reflect the latest version (of
     course!) and it should also contain a RCS directory with the
     corresponding archives (I don't have this now).

   * There should also be a ChangeLog file (this is more useful than the
     RCS archive but can be generated automatically from the later by
     Emacs).

   * A "core group" should judge about questionable changes (for now
     this group consists solely by me but I ask some others
     occasionally; this also seems to work).



File: gettext.info,  Node: Mailing Lists,  Prev: National Teams,  Up: Organization

Mailing Lists
-------------

   If we get any inquiries about GNU `gettext', send them on to:

     `translation@iro.umontreal.ca'

   The `*-pretest' lists are quite useful to me, maybe the idea could
be generalized to many GNU, and non-GNU packages.  But each maintainer
his/her way!

   Franc,ois, we have a mechanism in place here at `gnu.ai.mit.edu' to
track teams, support mailing lists for them and log members.  We have a
slight preference that you use it.  If this is OK with you, I can get
you clued in.

   Things are changing!  A few years ago, when Daniel Fekete and I
asked for a mailing list for GNU localization, nested at the FSF, we
were politely invited to organize it anywhere else, and so did we.  For
communicating with my pretesters, I later made a handful of mailing
lists located at iro.umontreal.ca and administrated by `majordomo'.
These lists have been _very_ dependable so far...

   I suspect that the German team will organize itself a mailing list
located in Germany, and so forth for other countries.  But before they
organize for true, it could surely be useful to offer mailing lists
located at the FSF to each national team.  So yes, please explain me
how I should proceed to create and handle them.

   We should create temporary mailing lists, one per country, to help
people organize.  Temporary, because once regrouped and structured, it
would be fair the volunteers from country bring back _their_ list in
there and manage it as they want.  My feeling is that, in the long run,
each team should run its own list, from within their country.  There
also should be some central list to which all teams could subscribe as
they see fit, as long as each team is represented in it.