wp-cli / language-command
安装、激活和管理语言包。
Requires
- wp-cli/wp-cli: ^2.5
Requires (Dev)
- wp-cli/db-command: ^1.3 || ^2
- wp-cli/entity-command: ^1.3 || ^2
- wp-cli/extension-command: ^1.2 || ^2
- wp-cli/wp-cli-tests: ^4
This package is auto-updated.
Last update: 2024-09-08 08:53:23 UTC
README
安装、激活和管理语言包。
使用
此包实现了以下命令
wp language
安装、激活和管理语言包。
wp language
示例
# Install the Dutch core language pack.
$ wp language core install nl_NL
Downloading translation from https://downloads.wordpress.org/translation/core/6.4.3/nl_NL.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the translation...
Translation updated successfully.
Language 'nl_NL' installed.
Success: Installed 1 of 1 languages.
# Activate the Dutch core language pack.
$ wp site switch-language nl_NL
Success: Language activated.
# Install the Dutch theme language pack for Twenty Ten.
$ wp language theme install twentyten nl_NL
Downloading translation from https://downloads.wordpress.org/translation/theme/twentyten/4.0/nl_NL.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the translation...
Translation updated successfully.
Language 'nl_NL' installed.
Success: Installed 1 of 1 languages.
# Install the Dutch plugin language pack for Hello Dolly.
$ wp language plugin install hello-dolly nl_NL
Downloading translation from https://downloads.wordpress.org/translation/plugin/hello-dolly/1.7.2/nl_NL.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the translation...
Translation updated successfully.
Language 'nl_NL' installed.
Success: Installed 1 of 1 languages.
wp language core
安装、激活和管理核心语言包。
wp language core
示例
# Install the Dutch core language pack.
$ wp language core install nl_NL
Downloading translation from https://downloads.wordpress.org/translation/core/6.4.3/nl_NL.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the translation...
Translation updated successfully.
Language 'nl_NL' installed.
Success: Installed 1 of 1 languages.
# Activate the Dutch core language pack.
$ wp site switch-language nl_NL
Success: Language activated.
# Uninstall the Dutch core language pack.
$ wp language core uninstall nl_NL
Success: Language uninstalled.
# List installed core language packs.
$ wp language core list --status=installed
+----------+--------------+-------------+-----------+-----------+---------------------+
| language | english_name | native_name | status | update | updated |
+----------+--------------+-------------+-----------+-----------+---------------------+
| nl_NL | Dutch | Nederlands | installed | available | 2024-01-31 10:24:06 |
+----------+--------------+-------------+-----------+-----------+---------------------+
wp language core activate
激活指定语言。
wp language core activate <language>
警告: wp language core activate
已弃用。请使用 wp site switch-language
代替。
选项
<language>
Language code to activate.
示例
# Activate the given language.
$ wp language core activate ja
Success: Language activated.
wp language core is-installed
检查是否已安装指定语言。
wp language core is-installed <language>
已安装时返回退出代码 0,未安装时返回 1。
选项
<language>
The language code to check.
示例
# Check whether the German language is installed; exit status 0 if installed, otherwise 1.
$ wp language core is-installed de_DE
$ echo $?
1
wp language core install
安装指定语言。
wp language core install <language>... [--activate]
从 WordPress.org 下载语言包。在以下位置查找您的语言代码: https://translate.wordpress.org/
选项
<language>...
Language code to install.
[--activate]
If set, the language will be activated immediately after install.
示例
# Install the Brazilian Portuguese language.
$ wp language core install pt_BR
Downloading translation from https://downloads.wordpress.org/translation/core/6.5/pt_BR.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the translation...
Translation updated successfully.
Language 'pt_BR' installed.
Success: Installed 1 of 1 languages.
wp language core list
列出所有可用的语言。
wp language core list [--field=<field>] [--<field>=<value>] [--fields=<fields>] [--format=<format>]
选项
[--field=<field>]
Display the value of a single field
[--<field>=<value>]
Filter results by key=value pairs.
[--fields=<fields>]
Limit the output to specific fields.
[--format=<format>]
Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- count
---
可用的字段
以下字段将默认显示每个翻译
- language
- english_name
- native_name
- status
- update
- updated
示例
# List language,english_name,status fields of available languages.
$ wp language core list --fields=language,english_name,status
+----------------+-------------------------+-------------+
| language | english_name | status |
+----------------+-------------------------+-------------+
| ar | Arabic | uninstalled |
| ary | Moroccan Arabic | uninstalled |
| az | Azerbaijani | uninstalled |
wp language core uninstall
卸载指定语言。
wp language core uninstall <language>...
选项
<language>...
Language code to uninstall.
示例
# Uninstall the Japanese core language pack.
$ wp language core uninstall ja
Success: Language uninstalled.
wp language core update
更新核心安装的语言。
wp language core update [--dry-run]
选项
[--dry-run]
Preview which translations would be updated.
示例
# Update installed core languages packs.
$ wp language core update
Updating 'Japanese' translation for WordPress 6.4.3...
Downloading translation from https://downloads.wordpress.org/translation/core/6.4.3/ja.zip...
Translation updated successfully.
Success: Updated 1/1 translation.
wp language plugin
安装、激活和管理插件语言包。
wp language plugin
示例
# Install the Dutch plugin language pack for Hello Dolly.
$ wp language plugin install hello-dolly nl_NL
Downloading translation from https://downloads.wordpress.org/translation/plugin/hello-dolly/1.7.2/nl_NL.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the translation...
Translation updated successfully.
Language 'nl_NL' installed.
Success: Installed 1 of 1 languages.
# Uninstall the Dutch plugin language pack for Hello Dolly.
$ wp language plugin uninstall hello-dolly nl_NL
Language 'nl_NL' for 'hello-dolly' uninstalled.
+-------------+--------+-------------+
| name | locale | status |
+-------------+--------+-------------+
| hello-dolly | nl_NL | uninstalled |
+-------------+--------+-------------+
Success: Uninstalled 1 of 1 languages.
# List installed plugin language packs for Hello Dolly.
$ wp language plugin list hello-dolly --status=installed
+-------------+----------+--------------+-------------+-----------+--------+---------------------+
| plugin | language | english_name | native_name | status | update | updated |
+-------------+----------+--------------+-------------+-----------+--------+---------------------+
| hello-dolly | nl_NL | Dutch | Nederlands | installed | none | 2023-11-13 12:34:15 |
+-------------+----------+--------------+-------------+-----------+--------+---------------------+
wp language plugin is-installed
检查是否已安装指定语言。
wp language plugin is-installed <plugin> <language>...
已安装时返回退出代码 0,未安装时返回 1。
选项
<plugin>
Plugin to check for.
<language>...
The language code to check.
示例
# Check whether the German language is installed for Akismet; exit status 0 if installed, otherwise 1.
$ wp language plugin is-installed akismet de_DE
$ echo $?
1
wp language plugin install
为插件安装指定语言。
wp language plugin install [<plugin>] [--all] <language>... [--format=<format>]
从 WordPress.org 下载语言包。
选项
[<plugin>]
Plugin to install language for.
[--all]
If set, languages for all plugins will be installed.
<language>...
Language code to install.
[--format=<format>]
Render output in a particular format. Used when installing languages for all plugins.
---
default: table
options:
- table
- csv
- json
- summary
---
示例
# Install the Japanese language for Akismet.
$ wp language plugin install akismet ja
Downloading translation from https://downloads.wordpress.org/translation/plugin/akismet/4.0.3/ja.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the translation...
Translation updated successfully.
Language 'ja' installed.
Success: Installed 1 of 1 languages.
wp language plugin list
列出一个或多个插件的全部可用语言。
wp language plugin list [<plugin>...] [--all] [--field=<field>] [--<field>=<value>] [--fields=<fields>] [--format=<format>]
选项
[<plugin>...]
One or more plugins to list languages for.
[--all]
If set, available languages for all plugins will be listed.
[--field=<field>]
Display the value of a single field.
[--<field>=<value>]
Filter results by key=value pairs.
[--fields=<fields>]
Limit the output to specific fields.
[--format=<format>]
Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- count
---
可用的字段
以下字段将默认显示每个翻译
- plugin
- language
- english_name
- native_name
- status
- update
- updated
示例
# List available language packs for the plugin.
$ wp language plugin list hello-dolly --fields=language,english_name,status
+----------------+-------------------------+-------------+
| language | english_name | status |
+----------------+-------------------------+-------------+
| ar | Arabic | uninstalled |
| ary | Moroccan Arabic | uninstalled |
| az | Azerbaijani | uninstalled |
wp language plugin uninstall
为插件卸载指定语言。
wp language plugin uninstall [<plugin>] [--all] <language>... [--format=<format>]
选项
[<plugin>]
Plugin to uninstall language for.
[--all]
If set, languages for all plugins will be uninstalled.
<language>...
Language code to uninstall.
[--format=<format>]
Render output in a particular format. Used when installing languages for all plugins.
---
default: table
options:
- table
- csv
- json
- summary
---
示例
# Uninstall the Japanese plugin language pack for Hello Dolly.
$ wp language plugin uninstall hello-dolly ja
Language 'ja' for 'hello-dolly' uninstalled.
+-------------+--------+-------------+
| name | locale | status |
+-------------+--------+-------------+
| hello-dolly | ja | uninstalled |
+-------------+--------+-------------+
Success: Uninstalled 1 of 1 languages.
wp language plugin update
更新一个或多个插件安装的语言。
wp language plugin update [<plugin>...] [--all] [--dry-run]
选项
[<plugin>...]
One or more plugins to update languages for.
[--all]
If set, languages for all plugins will be updated.
[--dry-run]
Preview which translations would be updated.
示例
# Update all installed language packs for all plugins.
$ wp language plugin update --all
Updating 'Japanese' translation for Akismet 3.1.11...
Downloading translation from https://downloads.wordpress.org/translation/plugin/akismet/3.1.11/ja.zip...
Translation updated successfully.
Success: Updated 1/1 translation.
wp language theme
安装、激活和管理主题语言包。
wp language theme
示例
# Install the Dutch theme language pack for Twenty Ten.
$ wp language theme install twentyten nl_NL
Downloading translation from https://downloads.wordpress.org/translation/theme/twentyten/4.0/nl_NL.zip...
Unpacking the update...
Installing the latest version...
Removing the old version of the translation...
Translation updated successfully.
Language 'nl_NL' installed.
Success: Installed 1 of 1 languages.
# Uninstall the Dutch theme language pack for Twenty Ten.
$ wp language theme uninstall twentyten nl_NL
Language 'nl_NL' for 'twentyten' uninstalled.
+-----------+--------+-------------+
| name | locale | status |
+-----------+--------+-------------+
| twentyten | nl_NL | uninstalled |
+-----------+--------+-------------+
Success: Uninstalled 1 of 1 languages.
# List installed theme language packs for Twenty Ten.
$ wp language theme list twentyten --status=installed
+-----------+----------+--------------+-------------+-----------+--------+---------------------+
| theme | language | english_name | native_name | status | update | updated |
+-----------+----------+--------------+-------------+-----------+--------+---------------------+
| twentyten | nl_NL | Dutch | Nederlands | installed | none | 2023-12-29 21:21:39 |
+-----------+----------+--------------+-------------+-----------+--------+---------------------+
wp language theme is-installed
检查是否已安装指定语言。
wp language theme is-installed <theme> <language>...
已安装时返回退出代码 0,未安装时返回 1。
选项
<theme>
Theme to check for.
<language>...
The language code to check.
示例
# Check whether the German language is installed for Twenty Seventeen; exit status 0 if installed, otherwise 1.
$ wp language theme is-installed twentyseventeen de_DE
$ echo $?
1
wp language theme install
为主题安装指定语言。
wp language theme install [<theme>] [--all] <language>... [--format=<format>]
从 WordPress.org 下载语言包。
选项
[<theme>]
Theme to install language for.
[--all]
If set, languages for all themes will be installed.
<language>...
Language code to install.
[--format=<format>]
Render output in a particular format. Used when installing languages for all themes.
---
default: table
options:
- table
- csv
- json
- summary
---
示例
# Install the Japanese language for Twenty Seventeen.
$ wp language theme install twentyseventeen ja
Downloading translation from https://downloads.wordpress.org/translation/theme/twentyseventeen/1.3/ja.zip...
Unpacking the update...
Installing the latest version...
Translation updated successfully.
Language 'ja' installed.
Success: Installed 1 of 1 languages.
wp language theme list
列出一个或多个主题的全部可用语言。
wp language theme list [<theme>...] [--all] [--field=<field>] [--<field>=<value>] [--fields=<fields>] [--format=<format>]
选项
[<theme>...]
One or more themes to list languages for.
[--all]
If set, available languages for all themes will be listed.
[--field=<field>]
Display the value of a single field.
[--<field>=<value>]
Filter results by key=value pairs.
[--fields=<fields>]
Limit the output to specific fields.
[--format=<format>]
Render output in a particular format.
---
default: table
options:
- table
- csv
- json
- count
---
可用的字段
以下字段将默认显示每个翻译
- theme
- language
- english_name
- native_name
- status
- update
- updated
示例
# List available language packs for the theme.
$ wp language theme list twentyten --fields=language,english_name,status
+----------------+-------------------------+-------------+
| language | english_name | status |
+----------------+-------------------------+-------------+
| ar | Arabic | uninstalled |
| ary | Moroccan Arabic | uninstalled |
| az | Azerbaijani | uninstalled |
wp language theme uninstall
为主题卸载指定语言。
wp language theme uninstall [<theme>] [--all] <language>... [--format=<format>]
选项
[<theme>]
Theme to uninstall language for.
[--all]
If set, languages for all themes will be uninstalled.
<language>...
Language code to uninstall.
[--format=<format>]
Render output in a particular format. Used when installing languages for all themes.
---
default: table
options:
- table
- csv
- json
- summary
---
示例
# Uninstall the Japanese theme language pack for Twenty Ten.
$ wp language theme uninstall twentyten ja
Language 'ja' for 'twentyten' uninstalled.
+-----------+--------+-------------+
| name | locale | status |
+-----------+--------+-------------+
| twentyten | ja | uninstalled |
+-----------+--------+-------------+
Success: Uninstalled 1 of 1 languages.
wp language theme update
更新一个或多个主题安装的语言。
wp language theme update [<theme>...] [--all] [--dry-run]
选项
[<theme>...]
One or more themes to update languages for.
[--all]
If set, languages for all themes will be updated.
[--dry-run]
Preview which translations would be updated.
示例
# Update all installed language packs for all themes.
$ wp language theme update --all
Updating 'Japanese' translation for Twenty Fifteen 1.5...
Downloading translation from https://downloads.wordpress.org/translation/theme/twentyfifteen/1.5/ja.zip...
Translation updated successfully.
Success: Updated 1/1 translation.
wp site switch-language
激活指定语言。
wp site switch-language <language>
选项
<language>
Language code to activate.
示例
$ wp site switch-language ja
Success: Language activated.
安装中
此包包含在 WP-CLI 自身中,无需额外安装。
要安装此包的最新版本(超过 WP-CLI 包含的版本),请运行
wp package install [email protected]:wp-cli/language-command.git
贡献
我们感谢您主动为该项目做出贡献。
贡献不仅限于代码。我们鼓励您以最适合您能力的方式做出贡献,例如编写教程、在当地聚会中提供演示、帮助其他用户解决支持问题或修订我们的文档。
若想了解更多信息,请查阅WP-CLI 贡献指南。本包遵循那些政策和指南。
报告错误
认为找到了错误?我们非常希望您能帮助我们修复它。
在创建新问题之前,您应该先搜索现有问题,查看是否已有针对该错误的解决方案,或者它是否已在最新版本中修复。
经过一番搜索,发现没有关于您错误的开放或已修复问题后,请创建一个新问题。尽可能提供详细的信息,并在可能的情况下提供清晰的复现步骤。更多指导,请查看我们的错误报告文档。
创建拉取请求
想要贡献一个新特性?请首先打开一个新问题,讨论该特性是否适合本项目。
一旦决定投入时间来完成您的拉取请求,请遵循我们创建拉取请求的指南,以确保体验愉快。有关在本地工作于此包的详细信息,请参阅"设置"。
支持
GitHub 问题不是用于一般支持问题,但您可以尝试其他途径:https://wp-cli.org/#support
此 README.md 是使用 wp scaffold package-readme
(文档)从项目代码库动态生成的。若要提出更改建议,请提交针对代码库相应部分的拉取请求。