// vim:set filetype=asciidoc:
[[i18n-example]]
=== Internationalization

Here is an example of updating the simple upstream C source *debhello-2.0.tar.gz* presented in "`<<autotools-multi>>`" for internationalization (i18n) and creating the updated upstream C source *debhello-2.0.tar.gz*.

In the real situation, the package should already be internationalized.  So this example is educational for you to understand how this internationalization is implemented.

TIP: The routine maintainer activity for the i18n is simply to add translation po files reported to you via the Bug Tracking System (BTS) to the *po/* directory and to update the language list in the *po/LINGUAS* file.

Let's get the source and make the Debian package.

.Download *debhello-2.0.tar.gz* (i18n)
----
include::../examples/debhello-2.0_build-2/step000.slog[]
----

Internationalize this source tree with the *gettextize* command and remove files auto-generated by Autotools.

.run *gettextize* (i18n):
----
include::../examples/debhello-2.0_build-2/step150.slog[]
----

Let's check generated files under the *po/* directory.

.files in *po* (i18n):
----
include::../examples/debhello-2.0_build-2/step151.slog[]
----

Let's update the *configure.ac* by adding "`*AM_GNU_GETTEXT([external])*`", etc..

.*configure.ac* (i18n):
----
include::../examples/debhello-2.0_build-2/step152.slog[]
----

Let's create the *po/Makevars* file from the *po/Makevars.template* file.

.*po/Makevars* (i18n):
----
include::../examples/debhello-2.0_build-2/step153.slog[]
----

Let's update C sources for the i18n version by wrapping strings with *_(...)*.

.*src/hello.c* (i18n):
----
include::../examples/debhello-2.0_build-2/step154.slog[]
----

.*lib/sharedlib.c* (i18n):
----
include::../examples/debhello-2.0_build-2/step155.slog[]
----

The new *gettext* (v=0.19) can handle the i18n version of the desktop file directly.

.*data/hello.desktop.in* (i18n):
----
include::../examples/debhello-2.0_build-2/step156.slog[]
----

Let's list the input files to extract translatable strings in *po/POTFILES.in*.

.*po/POTFILES.in* (i18n):
----
include::../examples/debhello-2.0_build-2/step157.slog[]
----

Here is the updated root *Makefile.am* with *po* added to the *SUBDIRS* environment variable.

.*Makefile.am* (i18n):
----
include::../examples/debhello-2.0_build-2/step158.slog[]
----

Let's make a translation template file, *debhello.pot*.

.*po/debhello.pot* (i18n):
----
include::../examples/debhello-2.0_build-2/step160.slog[]
----

Let's add a translation for French.

.*po/LINGUAS* and *po/fr.po* (i18n):
----
include::../examples/debhello-2.0_build-2/step161.slog[]
----

The packaging activities are practically the same as the one in "`<<autotools-multi>>`".

You can find more i18n examples by following "`<<details>>`".
