LinuxCommandLibrary

gettextize

Prepare a program for translation

SYNOPSIS

gettextize [OPTION]... [PACKAGE]

PARAMETERS

-c, --copy
    Copy files into source directory instead of symlinking

-f, --force
    Force overwrite of existing files

--intl
    Install only libintl-related files (e.g., libintl.m4)

--po-dir=DIR
    Specify the po/ directory location

-n, --no-changelog
    Do not update or create ChangeLog file

--add
    Add another application to the template files

--verbose
    Print detailed operation messages

--dry-run
    Show actions without executing them

--version
    Display version information and exit

--help
    Show usage summary and exit

DESCRIPTION

The gettextize command prepares a software package for internationalization (i18n) using the GNU gettext framework. It automates the setup by copying or symlinking essential files into the source tree, such as po/Makefile.in.in, config.rpath, and various m4/ macros like gettext.m4. It creates directories like po/ for Portable Object (.po) files and m4/ for macro definitions.

Typically invoked in the root of an autoconf/automake-based project, it updates configure.ac (or configure.in) by inserting required AM_GNU_GETTEXT and AM_ICONV macros. This enables the build system to generate translation catalogs via tools like msgfmt.

gettextize is crucial for developers aiming to support multiple languages, streamlining what would otherwise be a manual, error-prone process. After running it, projects can use xgettext to extract strings, msgmerge for updates, and compile .mo files for runtime use.

CAVEATS

Modifies source files in place; backup tree first. Designed for autoconf/automake projects. Symlinks may break if files move. Run before autoreconf.

TYPICAL WORKFLOW

Run gettextize --copy, then autoreconf -fiv, ./configure, make. Extract strings with xgettext.

OUTPUT FILES

Adds ABOUT-NLS, po/Makevars.template, updates configure.ac with gettext macros.

HISTORY

Introduced in GNU gettext 0.10.35 (2000); matured in 0.12+ with better automake integration. Maintained by gettext maintainers for i18n automation.

SEE ALSO

autopoint(1), aclocal(1), autoreconf(1), xgettext(1), msgmerge(1)

Copied to clipboard