Git Product home page Git Product logo

isabella232 / jetpack-composer-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from automattic/jetpack-composer-plugin

0.0 0.0 0.0 36 KB

[READ-ONLY] A custom installer plugin for Composer to move Jetpack packages out of `vendor/` so WordPress's translation infrastructure will find their strings. This repository is a mirror, for issue tracking and development head to: https://github.com/automattic/jetpack

License: Other

PHP 100.00%

jetpack-composer-plugin's Introduction

composer-plugin

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)

jetpack-composer-plugin's People

Contributors

anomiex avatar jeherve avatar kraftbj avatar samiff avatar coder-karen avatar jwebbdev avatar sdixon194 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.