mirror of
https://ghproxy.net/https://github.com/wp-cli/i18n-command.git
synced 2025-08-18 05:31:10 +08:00
Begin with wp scaffold package
This commit is contained in:
parent
daea90efba
commit
a758ca9320
9 changed files with 124 additions and 81 deletions
|
@ -11,3 +11,6 @@ features/
|
|||
utils/
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.swp
|
||||
*.txt
|
||||
*.log
|
||||
|
|
11
.github/ISSUE_TEMPLATE
vendored
Normal file
11
.github/ISSUE_TEMPLATE
vendored
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!--
|
||||
|
||||
Thanks for creating a new issue!
|
||||
|
||||
Found a bug or want to suggest an enhancement? Before completing your issue, please review our best practices: https://make.wordpress.org/cli/handbook/bug-reports/
|
||||
|
||||
Need help with something? GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support
|
||||
|
||||
You can safely delete this comment.
|
||||
|
||||
-->
|
16
.github/PULL_REQUEST_TEMPLATE
vendored
Normal file
16
.github/PULL_REQUEST_TEMPLATE
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
<!--
|
||||
|
||||
Thanks for submitting a pull request!
|
||||
|
||||
Please review our contributing guidelines if you haven't recently: https://make.wordpress.org/cli/handbook/contributing/#creating-a-pull-request
|
||||
|
||||
Here's an overview to our process:
|
||||
|
||||
1. One of the project committers will soon provide a code review: https://make.wordpress.org/cli/handbook/code-review/
|
||||
2. You are expected to address the code review comments in a timely manner (if we don't hear from you in two weeks, we'll consider your pull request abandoned).
|
||||
3. Please make sure to include functional tests for your changes.
|
||||
4. The reviewing committer will merge your pull request as soon as it passes code review (and provided it fits within the scope of the project).
|
||||
|
||||
You can safely delete this comment.
|
||||
|
||||
-->
|
22
.github/settings.yml
vendored
Normal file
22
.github/settings.yml
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
# Used by Probot Settings: https://probot.github.io/apps/settings/
|
||||
repository:
|
||||
description: Create POT files for WordPress projects
|
||||
labels:
|
||||
- name: bug
|
||||
color: fc2929
|
||||
- name: scope:documentation
|
||||
color: 0e8a16
|
||||
- name: scope:testing
|
||||
color: 5319e7
|
||||
- name: good-first-issue
|
||||
color: eb6420
|
||||
- name: help-wanted
|
||||
color: 159818
|
||||
- name: maybelater
|
||||
color: c2e0c6
|
||||
- name: state:unconfirmed
|
||||
color: bfe5bf
|
||||
- name: state:unsupported
|
||||
color: bfe5bf
|
||||
- name: wontfix
|
||||
color: c2e0c6
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -4,3 +4,7 @@ node_modules/
|
|||
vendor/
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.swp
|
||||
*.txt
|
||||
*.log
|
||||
composer.lock
|
||||
|
|
8
CONTRIBUTING.md
Normal file
8
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,8 @@
|
|||
Contributing
|
||||
============
|
||||
|
||||
We appreciate you taking the initiative to contribute to this project.
|
||||
|
||||
Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.
|
||||
|
||||
For a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.
|
49
README.md
Normal file
49
README.md
Normal file
|
@ -0,0 +1,49 @@
|
|||
wp-cli/makepot-command
|
||||
======================
|
||||
|
||||
Create POT files for WordPress projects
|
||||
|
||||
[](https://travis-ci.org/wp-cli/makepot-command)
|
||||
|
||||
Quick links: [Using](#using) | [Installing](#installing) | [Contributing](#contributing) | [Support](#support)
|
||||
|
||||
## Using
|
||||
|
||||
|
||||
|
||||
## Installing
|
||||
|
||||
Installing this package requires WP-CLI v1.1.0 or greater. Update to the latest stable release with `wp cli update`.
|
||||
|
||||
Once you've done so, you can install this package with:
|
||||
|
||||
wp package install git@github.com:wp-cli/makepot-command.git
|
||||
|
||||
## Contributing
|
||||
|
||||
We appreciate you taking the initiative to contribute to this project.
|
||||
|
||||
Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.
|
||||
|
||||
For a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.
|
||||
|
||||
### Reporting a bug
|
||||
|
||||
Think you’ve found a bug? We’d love for you to help us get it fixed.
|
||||
|
||||
Before you create a new issue, you should [search existing issues](https://github.com/wp-cli/makepot-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.
|
||||
|
||||
Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/makepot-command/issues/new). Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, [review our bug report documentation](https://make.wordpress.org/cli/handbook/bug-reports/).
|
||||
|
||||
### Creating a pull request
|
||||
|
||||
Want to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/makepot-command/issues/new) to discuss whether the feature is a good fit for the project.
|
||||
|
||||
Once you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See "[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)" for details specific to working on this package locally.
|
||||
|
||||
## Support
|
||||
|
||||
Github issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support
|
||||
|
||||
|
||||
*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*
|
|
@ -1,33 +1,24 @@
|
|||
{
|
||||
"name": "swissspidy/wp-cli-makepot",
|
||||
"name": "wp-cli/makepot-command",
|
||||
"description": "Create POT files for WordPress projects",
|
||||
"type": "wp-cli-package",
|
||||
"homepage": "https://github.com/swissspidy/wp-cli-makepot",
|
||||
"support": {
|
||||
"issues": "https://github.com/swissspidy/wp-cli-makepot/issues"
|
||||
},
|
||||
"homepage": "https://github.com/wp-cli/makepot-command",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Pascal Birchler",
|
||||
"email": "pascal@required.com",
|
||||
"homepage": "https://pascalbirchler.com"
|
||||
}
|
||||
],
|
||||
"authors": [],
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"autoload": {
|
||||
"files": [ "makepot-command.php" ],
|
||||
"psr-4": {
|
||||
"Swissspidy\\WP_CLI_Makepot\\": "src/"
|
||||
},
|
||||
"files": [
|
||||
"makepot-command.php"
|
||||
]
|
||||
"WP_CLI\\Makepot\\": "src/"
|
||||
}
|
||||
},
|
||||
"require": {
|
||||
"wp-cli/wp-cli": "^1.1.0",
|
||||
"gettext/gettext": "^4.4"
|
||||
},
|
||||
"require": {},
|
||||
"require-dev": {
|
||||
"behat/behat": "~2.5",
|
||||
"wp-cli/wp-cli": "*"
|
||||
"behat/behat": "~2.5"
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Swissspidy\WP_CLI_Makepot;
|
||||
|
||||
use WP_CLI;
|
||||
use WP_CLI_Command;
|
||||
|
||||
class Makepot_Command extends WP_CLI_Command {
|
||||
/**
|
||||
* Create a POT file for a WordPress project.
|
||||
*
|
||||
* <directory>
|
||||
* : Directory to scan for string extraction.
|
||||
*
|
||||
* <output>
|
||||
* : Name of the resulting POT file.
|
||||
*
|
||||
* [--project=<type>]
|
||||
* : Type of project this POT file is for.
|
||||
* ---
|
||||
* default: generic
|
||||
* options:
|
||||
* - generic
|
||||
* - wp-frontend
|
||||
* - wp-admin
|
||||
* - wp-network-admin
|
||||
* - wp-tz
|
||||
* - wp-plugin
|
||||
* - wp-theme
|
||||
* - glotpress
|
||||
* - rosetta
|
||||
* - wporg-bb-forums
|
||||
* - wporg-themes
|
||||
* - wporg-plugins
|
||||
* - wporg-forums
|
||||
* - wordcamporg
|
||||
* ---
|
||||
*
|
||||
* ## EXAMPLES
|
||||
*
|
||||
* # Create a POT file for the WordPress plugin in the current directory
|
||||
* $ wp makepot . languages/my-plugin.pot --project=wp-plugin
|
||||
*
|
||||
* @when before_wp_load
|
||||
*/
|
||||
public function __invoke( $args, $assoc_args ) {
|
||||
$project = \WP_CLI\Utils\get_flag_value( $assoc_args, 'project', true );
|
||||
|
||||
require_once __DIR__ . '/../i18n-tools/makepot.php';
|
||||
|
||||
$makepot = new \MakePOT();
|
||||
|
||||
$result = $makepot->{str_replace( '-', '_', $project )}( $args[0], $args[1] );
|
||||
|
||||
if ( false === $result ) {
|
||||
WP_CLI::error( 'Could not generate a POT file!' );
|
||||
}
|
||||
|
||||
WP_CLI::success( 'Success: POT file successfully generated!' );
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue