gettextize
Prepare a program for translation
SYNOPSIS
gettextize [OPTION]...
PARAMETERS
--copy
Copy files, even if symlinks would be preferred. This forces a physical copy of files into the project's structure rather than creating symbolic links to the gettext installation.
--dry-run
Do not actually do anything, just show what would be done. Useful for previewing changes without modifying files.
--force
Overwrite existing files without asking. Use with caution, as it can undo manual modifications.
--no-changelog
Do not try to update ChangeLog. By default, gettextize attempts to record its changes in the project's ChangeLog file.
--no-libtool
Do not use libtool. This option is useful if the project does not utilize libtool or if gettextize is causing conflicts with an existing libtool setup.
--omit-header
Do not output AM_GNU_GETTEXT_VERSION comment in configure.ac.
--po-dir=DIR
Use DIR for the po/ directory instead of the default po. Allows custom placement of translation files.
--quiet
Suppress most output. Only errors will be displayed.
--verbose
Output more details about operations being performed.
--version
Display version information and exit.
--help
Display help message and exit.
DESCRIPTION
The gettextize command is a helper script provided by the GNU gettext utilities. Its primary purpose is to prepare a software package for internationalization (i18n) using the gettext system. When run from the top-level directory of an Autotools-based project, it performs several crucial setup steps. It copies necessary files like config.rpath and the po/Makefile.in.in template into the project structure. More importantly, it modifies the project's configure.ac (or configure.in) file by adding appropriate AM_GNU_GETTEXT macros and AC_CONFIG_SRCDIR directives, ensuring that the configure script will correctly handle gettext-related paths and definitions.
Furthermore, it creates or updates the po/ directory, which is where translation template files (.pot) and message catalogs (.po) reside. By automating these initial setup tasks, gettextize significantly simplifies the process of integrating gettext into new or existing projects, allowing developers to focus on marking strings for translation rather than configuring the build system. It's typically a one-time operation at the onset of internationalization efforts.
CAVEATS
gettextize is designed primarily for projects using GNU Autotools (Autoconf, Automake). It directly modifies files like configure.ac and creates/updates the po/ directory, assuming a standard Autotools project structure. Running it on a non-Autotools project or one with an unconventional build system may lead to unexpected behavior or errors.
It's generally a one-time setup command; subsequent runs might require using --force, which can overwrite manual changes. Ensure your project is backed up before running gettextize, especially with the --force option.
TYPICAL WORKFLOW
To use gettextize effectively, navigate to the top-level directory of your source package.
1. Run gettextize.
2. After running, you might need to run autoconf, automake --add-missing --force-missing, and libtoolize (if using libtool) to fully update your build system.
3. Then, you would typically run xgettext to create a .pot template, and msginit to create new .po files for specific languages.
4. Finally, you would run configure, make, and make install as usual.
INTEGRATION WITH AUTOTOOLS
gettextize modifies your configure.ac file by adding crucial Autoconf macros like AM_GNU_GETTEXT. This macro handles the detection of the gettext library and its necessary components, defines various C preprocessor symbols, and integrates gettext into the build process by generating Makefile rules for translation file compilation. It assumes that you are familiar with and are actively using Autotools for your project's build system.
HISTORY
gettextize is an integral part of the GNU gettext software internationalization framework, which was initiated by the GNU Project. The gettext library and its associated tools, including gettextize, were developed to provide a standardized and robust mechanism for developers to enable multilingual support in their applications. Its introduction aimed to simplify the often complex initial setup required for integrating internationalization features into projects, particularly those built with GNU Autotools. Over time, it has evolved alongside the gettext system, adapting to new versions of Autotools and improving its automation capabilities, making it a cornerstone utility for i18n-focused software development in the Unix/Linux ecosystem.