定制 automattic/jetpack-composer-plugin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

automattic/jetpack-composer-plugin

最新稳定版本:v4.0.5

Composer 安装命令:

composer require automattic/jetpack-composer-plugin

包简介

A custom installer plugin for Composer to move Jetpack packages out of `vendor/` so WordPress's translation infrastructure will find their strings.

README 文档

README

This is a custom installer plugin for Composer to help with WordPress translation of Composer libraries intended for use as shared code in plugins and themes.

When this plugin is installed, libraries with type set to jetpack-library will be installed into jetpack_vendor/ instead of the usual vendor/. Also translation text domain information will be collected from such libraries and written to jetpack_vendor/i18n-map.php.

Use in a WordPress plugin or theme

This plugin needs to be put into the require section of your composer.json file in order to be used.

 "require": { "automattic/jetpack-composer-plugin": "*" },

You'll also want to set extra.wp-plugin-slug or extra.wp-theme-slug to the WordPress.org slug, which is also the textdomain for your plugin or theme's translations.

 "extra": { "wp-plugin-slug": "my-plugin" },

Finally, for the libraries' translations to work, you'll also want to require automattic/jetpack-assets and include something like the following in your initialization code just after you load the autoloader:

\Automattic\Jetpack\Assets::alias_textdomains_from_file( __DIR__ . '/jetpack_vendor/i18n-map.php' );

Use by a library

A library that wants to be used in WordPress plugins or themes needs to set the type in composer.json to jetpack-library. The library package should not itself include a dependency on automattic/jetpack-composer-plugin, although it may suggest it.

All calls to __(), _x(), and other WordPress i18n functions should then use a textdomain unique to the library. This textdomain also needs to be declared in composer.json as extra.textdomain:

 "extra": { "textdomain": "my-library" },

License

composer-plugin is licensed under GNU General Public License v2 (or later)

统计信息

  • 总下载量: 33.2k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 6
  • 依赖项目数: 9
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-01-04