gettext 命令详解

| 选择喜欢的代码风格  

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

gettext 命令安装:


-bash/zsh: gettext: command not found

# Windows (WSL2)
sudo apt-get update sudo apt-get install gettext

# Debian
apt-get install gettext

# Ubuntu
apt-get install gettext

# Alpine
apk add gettext

# Arch Linux
pacman -S gettext

# Kali Linux
apt-get install gettext

# CentOS
yum install gettext

# Fedora
dnf install gettext

# OS X
brew install gettext

# Raspbian
apt-get install gettext

# Dockerfile
 dockerfile.run/gettext

# Docker
docker run cmd.cat/gettext gettext

gettext 命令补充说明:


gettext 是 GNU 国际化与本地化(i18n)函数库,它常被用于编写多语言程序,可以显示文本消息的母语翻译。gettext 同样是一种标准格式,gettext 中的消息,是由 msgidmsgstr 对组成。

msgid 为源字符串(一般为英文),msgstr 为翻译后的字符串。如下格式:

# Don't remove the two lines below, they're required for gettext to work correctly.

msgid ""
msgstr ""

# Example of a regular string.
msgid "Hello world!"
msgstr ""

# Example of a string with pluralization.
msgid "There is %d apple."
msgid_plural "There are %d apples."
msgstr[0] ""
msgstr[1] ""

# Example of a string with a translation context.
msgctxt "Actions"
msgid "Close"
msgstr ""

gettext 命令语法:


gettext [OPTION] [[TEXTDOMAIN] MSGID]
gettext [OPTION] -s [MSGID]...

gettext 扩展阅读:




gettext 命令评论