From cab4e9bbdfa8bd6784f0988769b62836cde86c7b Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Mon, 11 Mar 2024 11:17:01 +0545 Subject: [PATCH 1/2] Add example for update po command --- README.md | 16 +++++++++++++++- src/UpdatePoCommand.php | 16 +++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7c4c013..0f4ccef 100644 --- a/README.md +++ b/README.md @@ -270,12 +270,26 @@ This behaves similarly to the [msgmerge](https://www.gnu.org/software/gettext/ma **OPTIONS** - Path to an existing POT file to use for updating + Path to an existing POT file to use for updating. [] PO file to update or a directory containing multiple PO files. Defaults to all PO files in the source directory. +**EXAMPLES** + + # Update all PO files from a POT file in the same directory. + $ wp i18n update-po example-plugin.pot + Success: Updated 3 files. + + # Update a PO file from a POT file. + $ wp i18n update-po example-plugin.pot example-plugin-de_DE.po + Success: Updated 1 file. + + # Update all PO files from a POT file in the specific directory. + $ wp i18n update-po example-plugin.pot languages + Success: Updated 2 files. + ## Installing This package is included with WP-CLI itself, no additional installation necessary. diff --git a/src/UpdatePoCommand.php b/src/UpdatePoCommand.php index e739e18..70232c1 100644 --- a/src/UpdatePoCommand.php +++ b/src/UpdatePoCommand.php @@ -21,12 +21,26 @@ class UpdatePoCommand extends WP_CLI_Command { * ## OPTIONS * * - * : Path to an existing POT file to use for updating + * : Path to an existing POT file to use for updating. * * [] * : PO file to update or a directory containing multiple PO files. * Defaults to all PO files in the source directory. * + * ## EXAMPLES + * + * # Update all PO files from a POT file in the same directory. + * $ wp i18n update-po example-plugin.pot + * Success: Updated 3 files. + * + * # Update a PO file from a POT file. + * $ wp i18n update-po example-plugin.pot example-plugin-de_DE.po + * Success: Updated 1 file. + * + * # Update all PO files from a POT file in the specific directory. + * $ wp i18n update-po example-plugin.pot languages + * Success: Updated 2 files. + * * @when before_wp_load * * @throws WP_CLI\ExitException From 2e9866c9748cf0103bf09c06167d3cb7c367a750 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Mon, 11 Mar 2024 18:20:34 +0545 Subject: [PATCH 2/2] Update example explanation --- README.md | 4 ++-- src/UpdatePoCommand.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0f4ccef..10adbe2 100644 --- a/README.md +++ b/README.md @@ -278,7 +278,7 @@ This behaves similarly to the [msgmerge](https://www.gnu.org/software/gettext/ma **EXAMPLES** - # Update all PO files from a POT file in the same directory. + # Update all PO files from a POT file in the current directory. $ wp i18n update-po example-plugin.pot Success: Updated 3 files. @@ -286,7 +286,7 @@ This behaves similarly to the [msgmerge](https://www.gnu.org/software/gettext/ma $ wp i18n update-po example-plugin.pot example-plugin-de_DE.po Success: Updated 1 file. - # Update all PO files from a POT file in the specific directory. + # Update all PO files in a given directory from a POT file. $ wp i18n update-po example-plugin.pot languages Success: Updated 2 files. diff --git a/src/UpdatePoCommand.php b/src/UpdatePoCommand.php index 70232c1..f46f131 100644 --- a/src/UpdatePoCommand.php +++ b/src/UpdatePoCommand.php @@ -29,7 +29,7 @@ class UpdatePoCommand extends WP_CLI_Command { * * ## EXAMPLES * - * # Update all PO files from a POT file in the same directory. + * # Update all PO files from a POT file in the current directory. * $ wp i18n update-po example-plugin.pot * Success: Updated 3 files. * @@ -37,7 +37,7 @@ class UpdatePoCommand extends WP_CLI_Command { * $ wp i18n update-po example-plugin.pot example-plugin-de_DE.po * Success: Updated 1 file. * - * # Update all PO files from a POT file in the specific directory. + * # Update all PO files in a given directory from a POT file. * $ wp i18n update-po example-plugin.pot languages * Success: Updated 2 files. *