Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ README.md
CLAUDE.md
CHANGELOG.md
SECURITY.md
/languages
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
/CLAUDE.md export-ignore
/CHANGELOG.md export-ignore
/SECURITY.md export-ignore
/languages export-ignore

# Consistent line endings
* text=auto eol=lf
Expand Down
6 changes: 3 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ WordPress plugin, published on wordpress.org (slug `wirecore-rest-control`) and

## Translations

All UI strings are English in the code and translated in `languages/`: `de_DE` (informal) and `de_DE_formal` (formal). WP-CLI output stays English and untranslated. `load_plugin_textdomain()` is kept for the bundled translations until language packs exist on translate.wordpress.org.
All UI strings are English in the code. Translations are delivered as language packs from translate.wordpress.org, so there is no `load_plugin_textdomain()` and `languages/` is not shipped (wordpress.org review). `languages/` holds the template and the German translations `de_DE` (informal) and `de_DE_formal` (formal) for importing into translate.wordpress.org. WP-CLI output stays English and untranslated.

After changing strings (inside the Docker container, `P=wp-content/plugins/wirecore-rest-control`):

Expand All @@ -35,11 +35,11 @@ docker compose exec wordpress wp --allow-root i18n make-mo $P/languages
docker compose exec wordpress wp --allow-root i18n make-php $P/languages
```

`.po`, `.mo` and `.l10n.php` are part of the package. The files are created as root inside the container – `chown` them to your user if needed.
The files are created as root inside the container – `chown` them to your user if needed.

## Package contents

Only `wirecore-rest-control.php`, `uninstall.php`, `index.php`, `readme.txt`, `LICENSE`, `includes/`, `assets/` and `languages/` are shipped. New development or configuration files must be added to both `.distignore` and `.gitattributes` (`export-ignore`).
Only `wirecore-rest-control.php`, `uninstall.php`, `index.php`, `readme.txt`, `LICENSE`, `includes/` and `assets/` are shipped. New development or configuration files must be added to both `.distignore` and `.gitattributes` (`export-ignore`).

## Checks

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ wp wirecore-rest status
wp wirecore-rest routes [--namespace=<namespace>] [--source=<text>] [--format=table|json|csv]
wp wirecore-rest set <route|namespace> [--read=<rule>] [--write=<rule>]
wp wirecore-rest default [--read=<rule>] [--write=<rule>]
wp wirecore-rest export [<file>]
wp wirecore-rest export > settings.json
wp wirecore-rest import <file>
wp wirecore-rest log [--clear] [--format=table|json|csv]
```
Expand Down Expand Up @@ -120,7 +120,7 @@ Composer installs the dependencies for PHP 7.4 (`config.platform` in `composer.j

### Translations

All UI strings are English in the code (text domain `wirecore-rest-control`) and translated in `languages/`. After changing strings (`P=wp-content/plugins/wirecore-rest-control`):
All UI strings are English in the code (text domain `wirecore-rest-control`). Translations are delivered as language packs from translate.wordpress.org; `languages/` holds the template and the German translations for importing there and is not shipped. After changing strings (`P=wp-content/plugins/wirecore-rest-control`):

```bash
docker compose exec wordpress wp --allow-root i18n make-pot $P $P/languages/wirecore-rest-control.pot --domain=wirecore-rest-control --exclude=node_modules,db-data,languages
Expand Down
18 changes: 5 additions & 13 deletions includes/class-wirecore-rc-cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,27 +220,19 @@ public function set_default($args, $assoc_args)
}

/**
* Exports the settings as JSON.
* Exports the settings as JSON to STDOUT.
*
* ## OPTIONS
* ## EXAMPLES
*
* [<file>]
* : Target file. Prints to STDOUT if omitted.
* wp wirecore-rest export > settings.json
*/
public function export($args)
public function export()
{
$json = wp_json_encode(
WireCore_RC_Settings::export(),
JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE
);
if (!isset($args[0])) {
WP_CLI::line($json);
return;
}
if (file_put_contents($args[0], $json . "\n") === false) {
WP_CLI::error(sprintf('Could not write "%s".', $args[0]));
}
WP_CLI::success(sprintf('Exported to %s.', $args[0]));
WP_CLI::line($json);
}

/**
Expand Down
12 changes: 0 additions & 12 deletions wirecore-rest-control.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wirecore-rest-control
Domain Path: /languages
*/

// Prevent direct access
Expand All @@ -30,17 +29,6 @@
require_once __DIR__ . '/includes/class-wirecore-rc-guard.php';
require_once __DIR__ . '/includes/class-wirecore-rc-admin.php';

add_action('init', function () {
// Needed for the bundled translations until language packs exist on
// translate.wordpress.org.
// phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound
load_plugin_textdomain(
'wirecore-rest-control',
false,
dirname(plugin_basename(__FILE__)) . '/languages'
);
});

WireCore_RC_Guard::init();
WireCore_RC_Admin::rest_init();
if (is_admin()) {
Expand Down
Loading