From Mageia wiki
Jump to: navigation, search

This policy details how language support is implemented in Mageia.

RPM Macros

%lang

A file can be flagged %lang(LANG). This means it will only be installed if LANG is in %**install**langs:

$ cat /etc/rpm/macros
%install langs en:fr:ja

You should always use %find_lang which should do everything for you.

%find_lang

Use macro %find_lang to collect and mark locale-dependent files.

Synopsis:

%find_lang name [filelist]

The macro %find_lang searches the directories /usr/share/locale and /usr/share/locale/*/LC_MESSAGES for name.mo files. It also searches gnome/help/name and kde**/share/doc/HTML/**/name directories for localized documentation. Then it creates the file filelist where the files are marked by the respective %lang(locale) tag and also by the %doc tag. Such a file list can be then passed to the %files tag via -f option. See below for an example.

The optional filelist defines the name of the file where the generated list of files is stored. name.lang is used if not defined.

Example:

%install
...
%find_lang %{name}              # generate a special file list
...
  
%files -f %{name}.lang          # use the special file list
%defattr(-,root,root)           # list the other files
%doc README
...

Explicit %lang

In some cases, you may need to add things not handled by %find_lang. Example from numlock.spec:

%files
%defattr(755,root,root)
...
%lang(cs) /usr/X11R6/man/cs/man1/*
%lang(et) /usr/X11R6/man/et/man1/*
%lang(eu) /usr/X11R6/man/eu/man1/*
...

Multiple man pages

It is possible to handle multiple man pages in different languages with the macro:

%find_lang %{name} --with-man

%lang drawback

When adding a language on an installed system, the %lang flagged files in already installed packages are not added. This is why localedrake only proposes languages chosen during installation.

One package per language

%lang is quite nice for "not too big" language dependent files. When the size is quite big, it's interesting to create separate packages:

  • to reduce the size of the package when one install over network
  • to allow users to choose which l10n packages to mirror
  • to create distributions with only the wanted l10n packages

The per language package should:

  • be named alike openoffice.org-l10n-LANG or man-pages-LANG, where LANG is the locale name e.g.: fr, pt_BR...)
  • provide a virtual package like openoffice.org-l10n or man-pages-l10n or aspell-dictionary (this allows Suggest: aspell-dictionary, work in progress )
  • require the corresponding locale, to allow a simple heuristic search to choose the best package (e.g.: if locales-fr is installed, choose aspell-fr because aspell-fr requires locales-fr)

Authors

  • Vincent Danen
  • Pascal Rigaux
  • Zézinho
  • Daniel Kreuter
  • Rémy CLOUARD