Internationalization plumbing for shell-based commands.
Internal i18n helper: the gettext wrapper Git's shell-script subcommands use to emit translated messages. Effectively a portable shim around gettext.sh.
A tiny shell library, not really a command. Sourced or invoked by Git's .sh plumbing to translate user-facing strings and substitute variables, falling back to passthrough when gettext isn't built in.
git sh-i18n--envsubst <format>
# More commonly sourced by other scripts:
. "$(git --exec-path)/git-sh-i18n"
gettext "untranslated string"
eval_gettext "Hello, \$user"
| Flag | What it does |
|---|---|
--envsubst | Substitute $VAR references in the supplied format string from the environment |
(sourced) gettext | Translate a literal string via the message catalog |
(sourced) eval_gettext | Translate, then expand $var references safely |
(sourced) eval_ngettext | Plural form of eval_gettext, picks singular/plural by count |
git stash or git rebase scripts. "$(git --exec-path)/git-sh-i18n"gettext 'Switched to a new branch'user=alice; eval_gettext 'Hello, \$user'name=world git sh-i18n--envsubst 'Hello, $name'eval_gettext instead of gettext whenever you need variable interpolation; it's the only safe way.gettext call is a passthrough - silently masking missing translations.$var before eval_gettext sees it.Hit each option, then Check answers. Score is recorded; Next is always open.