PackagingDrafts/find lang

Handling Locale Files
Translation files may be handled by different programs for different frameworks. Make sure you BuildRequire the correct package or else your package could fail to generate translation files in the buildroot.

If the package uses gettext for translations, add BuildRequires: gettext

For Qt-based packages that use the Linguist tool chain, for the localisation utilities add BuildRequires: qt-devel

Fedora includes an rpm macro called. This macro will locate all of the locale files that belong to your package (by name), and put this list in a file. You can then use that file to include all of the locales. should be run in the %install section of your spec file, after all of the files have been installed into the buildroot. The correct syntax for  is usually: %find_lang %{name} In some cases, the application may use a different "name" for its locales. You may have to look at the locale files and see what they are named. If they are named, then you will need to pass   to   instead of. After  is run, it will generate a file in the active directory (by default, the top level of the source dir). This file will be named based on what you passed as the option to the  macro. Usually, it will be named. You should then use this file in the  list to include the locales detected by. To do this, you should include it with the -f parameter to. %files -f %{name}.lang %{_bindir}/foobar ...

Note that  by default searches for gettext locales, but it can also handle Qt translations, localised manpages and help files.

To process GNOME help files put into  use %find_lang %{name} --with-gnome

To process KDE help files put into  use %find_lang %{name} --with-kde

To process Qt's  binary translation files use %find_lang %{name} --with-qt

To process localised manpages (doesn't include the default, non-localised one), use %find_lang %{name} --with-man

To see all the options, run  in the terminal.

Names different from  (e.g. multiple manpages) must be handled via separate calls to.

Here is an example of proper usage of, in   with the "foo" application localised using gettext and man pages named "bar" instead of "foo":

Name: foo ... %prep %setup -q

%build %configure --with-cheese make %{?_smp_mflags}

%install make DESTDIR=%{buildroot} install %find_lang %{name} %find_lang bar --with-man

%files -f %{name}.lang -f bar.lang %doc LICENSE README %{_bindir}/%{name} %{_mandir}/man1/bar.1.gz

%changelog - add man pages example
 * Fri Jan 13 2012 Karel Volny  0.1-2

- sample spec that uses %%find_lang
 * Thu May 4 2006 Tom "spot" Callaway  0.1-1