Localization policy

Материал из Rosalab Wiki
Версия от 10:29, 9 февраля 2012; D uragan (обсуждение | вклад) (Adopted localization policy)

(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск
This policy details how language support is implemented in ROSA Linux.

RPM Macros


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

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

Normally, you should not mark files by yourself. You should always use %find_lang which should do everything for you.


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


%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 a 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.


%find_lang %{name}              # generate a special file list

%files -f %{name}.lang          # use the special file list
%defattr(-,root,root)           # list the other files

Explicit %lang

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

%lang(cs) /usr/X11R6/man/cs/man1/*
%lang(et) /usr/X11R6/man/et/man1/*
%lang(eu) /usr/X11R6/man/eu/man1/*

%lang drawback

When adding a language on a installed system, the %lang flagged files in already installed packages are not added. This is why localedrake only propose 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 (eg: fr, pt_BR...)
  • provide a virtual package alike openoffice.org-l10n or man-pages-l10n or aspell-dictionary (this allow Suggest: aspell-dictionary, !! work in progress !!)
  • require the corresponding locale, to allow a simple heuristic to choose the best package (eg: if locales-fr is installed, choose aspell-fr because aspell-fr requires locales-fr)

This Policy is based on the Mandriva Packaging and Localization Policy.