LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

gettext

internationalization message catalog lookup

TLDR

Display translated string
$ gettext [domain] "[message]"
copy
Translate from catalog
$ TEXTDOMAIN=[domain] gettext "[message]"
copy
With context
$ gettext -c "[context]" "[message]"
copy
Plural forms
$ ngettext "[singular]" "[plural]" [count]
copy

SYNOPSIS

gettext [options] [domain] msgid

DESCRIPTION

gettext retrieves translated strings from message catalogs. It's the runtime component of the GNU internationalization system, looking up translations based on the current locale.The tool searches .mo files for translations, returning the original if none found. It enables shell scripts and programs to produce localized output.gettext enables internationalization of command-line applications.

PARAMETERS

DOMAIN

Message catalog domain.
MSGID
Message to translate.
-d DOMAIN
Text domain.
-e
Enable escape interpretation.
-E
Preserve but don't interpret backslashes.
-c CONTEXT
Message context.
--help
Display help information.

CONFIGURATION

/usr/share/locale/[LANG]/LC_MESSAGES/[domain].mo

Compiled message catalogs containing translations for specific domains and locales.

INSTALL

sudo apt install gettext-base
copy
sudo dnf install gettext
copy
sudo pacman -S gettext
copy
sudo apk add gettext
copy
brew install gettext
copy
nix profile install nixpkgs#gettext
copy

CAVEATS

Requires compiled .mo catalogs. LANG/LC_MESSAGES must be set. Missing translations return original.

HISTORY

gettext was developed by GNU for internationalization. It became the standard Unix localization system, enabling software to support multiple languages.

SEE ALSO

xgettext(1), msgfmt(1), envsubst(1)

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid