From Fedora Project Wiki

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 %find_lang. 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. %find_lang 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 %find_lang 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 myapp.mo, then you will need to pass myapp to %find_lang instead of %{name}. After %find_lang 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 %find_lang macro. Usually, it will be named %{name}.lang. You should then use this file in the %files list to include the locales detected by %find_lang. To do this, you should include it with the -f parameter to %files.

%files -f %{name}.lang
%{_bindir}/foobar
...

Note that %find_lang 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 /usr/share/gnome/help/ use

%find_lang %{name} --with-gnome

To process KDE help files put into /usr/share/doc/HTML/ use

%find_lang %{name} --with-kde

To process Qt's .qm 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 /usr/lib/rpm/find-lang.sh in the terminal.

Names different from %{name} (e.g. multiple manpages) must be handled via separate calls to %find_lang.

Here is an example of proper usage of %find_lang, in foo.spec 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
* Fri Jan 13 2012 Karel Volny <kvolny@redhat.com> 0.1-2
- add man pages example

* Thu May 4 2006 Tom "spot" Callaway <tcallawa@redhat.com> 0.1-1
- sample spec that uses %%find_lang