From ee0661a88abf809395b64b89e9f343a9655e0926 Mon Sep 17 00:00:00 2001 From: Erick Hitter <git-contrib@ethitter.com> Date: Sat, 25 Jun 2022 08:37:28 -0700 Subject: [PATCH] Correct support for JS translations Fixes #23 --- README.md | 7 +++++++ inc/class-block-editor.php | 6 ++++++ languages/wp-revisions-control.pot | 4 ++-- package.json | 2 +- readme.txt | 7 +++++++ wp-revisions-control.php | 2 +- 6 files changed, 24 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8f05c2e..ce546e7 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,9 @@ Navigate to **Settings > Writing** in your WordPress Dashboard, and look for the ## Changelog ## +### 1.4.3 ### +* Fix translations in block editor. + ### 1.4.2 ### * Fix notice appearing on Widgets Block Editor. @@ -61,6 +64,10 @@ Navigate to **Settings > Writing** in your WordPress Dashboard, and look for the ## Upgrade Notice ## +### 1.4.3 ### + +Fixes translations in block editor. + ### 1.4.2 ### Fixes notice appearing on Widgets Block Editor. diff --git a/inc/class-block-editor.php b/inc/class-block-editor.php index f2d5f93..f35c51a 100644 --- a/inc/class-block-editor.php +++ b/inc/class-block-editor.php @@ -175,5 +175,11 @@ class Block_Editor { 'metaKey' => WP_REVISIONS_CONTROL_LIMIT_META_KEY, ) ); + + wp_set_script_translations( + $handle, + 'wp-revisions-control', + dirname( __DIR__ ) . '/languages' + ); } } diff --git a/languages/wp-revisions-control.pot b/languages/wp-revisions-control.pot index fa1a05e..8e08ee1 100644 --- a/languages/wp-revisions-control.pot +++ b/languages/wp-revisions-control.pot @@ -2,10 +2,10 @@ # This file is distributed under the same license as the WP Revisions Control package. msgid "" msgstr "" -"Project-Id-Version: WP Revisions Control 1.4.2\n" +"Project-Id-Version: WP Revisions Control 1.4.3\n" "Report-Msgid-Bugs-To: " "https://wordpress.org/support/plugin/wp-revisions-control\n" -"POT-Creation-Date: 2022-06-11 19:34:09+00:00\n" +"POT-Creation-Date: 2022-06-25 15:40:24+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/package.json b/package.json index c359039..bd60f67 100755 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "packages-update": "wp-scripts packages-update", "plugin-zip": "wp-scripts plugin-zip", "start": "wp-scripts start", - "test": "npm run test:e2e && npm run test:unit" + "test": "npm run test:e2e && npm run test:unit", "test:e2e": "wp-scripts test-e2e --passWithNoTests", "test:unit": "wp-scripts test-unit-js --passWithNoTests" } diff --git a/readme.txt b/readme.txt index 27a30cf..4395a5c 100644 --- a/readme.txt +++ b/readme.txt @@ -35,6 +35,9 @@ Navigate to **Settings > Writing** in your WordPress Dashboard, and look for the == Changelog == += 1.4.3 = +* Fix translations in block editor. + = 1.4.2 = * Fix notice appearing on Widgets Block Editor. @@ -61,6 +64,10 @@ Navigate to **Settings > Writing** in your WordPress Dashboard, and look for the == Upgrade Notice == += 1.4.3 = + +Fixes translations in block editor. + = 1.4.2 = Fixes notice appearing on Widgets Block Editor. diff --git a/wp-revisions-control.php b/wp-revisions-control.php index 272d2bf..3060a0a 100644 --- a/wp-revisions-control.php +++ b/wp-revisions-control.php @@ -4,7 +4,7 @@ * Plugin URI: https://ethitter.com/plugins/wp-revisions-control/ * Description: Control how many revisions are stored for each post type * Author: Erick Hitter - * Version: 1.4.2 + * Version: 1.4.3 * Author URI: https://ethitter.com/ * Text Domain: wp-revisions-control * Domain Path: /languages/ -- GitLab