Skip to content
Jarryd Beck edited this page Oct 1, 2014 · 7 revisions

This is a CMake module to create targets that update the translation files of GNU Gettext (http://www.gnu.org/software/gettext/gettext.html).

To use this module, place somewhere in your source tree, say cmake/GettextTranslate.cmake, then put the following in your CMakeLists.txt:

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/")
include(GettextTranslate)

By default, the translation targets are not added to the ALL target; if you would like them to be added, then add the following before the include line above:

set(GettextTranslate_ALL TRUE)

The Gettext binaries will be found automatically, but if you would like to provide a hint about where CMake should look, then the path to each binary can be set in the variable

GettextTranslate_BINARY

where the valid values for BINARY are the name of the executable in upper case.

The module reads variables from the Makevars file, the most important being DOMAIN, since the targets generated depend on it. This way you can have multiple domains in the same project, and have different targets generated. The targets added are:

  • update-po: update all the po files from the pot files.
  • update-gmo: update the gmo files from the po files.
  • ${DOMAIN}-pot.update: update the pot files from the source code.
  • generate-${DOMAIN}-${lang}-po: update the po files for only ${DOMAIN} and ${lang}
  • generate-${DOMAIN}-${lang}-gmo: update the gmo files for only ${DOMAIN} and ${lang}
Clone this wiki locally