From 8ac775947a6f65c0cf61b6d6be40fd1f933f4c87 Mon Sep 17 00:00:00 2001 From: Miina Sikk Date: Thu, 24 May 2018 22:11:50 +0300 Subject: [PATCH] Add separate locale for blocks. --- .babelrc | 2 +- amp.php | 3 +++ includes/admin/class-amp-editor-blocks.php | 2 +- languages/amp-js.pot | 4 ++++ 4 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 languages/amp-js.pot diff --git a/.babelrc b/.babelrc index 99f015d8819..0c2178c17d0 100644 --- a/.babelrc +++ b/.babelrc @@ -18,7 +18,7 @@ [ "@wordpress/babel-plugin-makepot", { - "output": "languages/amp.pot" + "output": "languages/amp-js.pot" } ] ], diff --git a/amp.php b/amp.php index 0cfba95132e..5bf102d55ae 100644 --- a/amp.php +++ b/amp.php @@ -137,6 +137,9 @@ function amp_init() { load_plugin_textdomain( 'amp', false, plugin_basename( AMP__DIR__ ) . '/languages' ); + // Load editor blocks translations. + load_plugin_textdomain( 'amp-js', false, plugin_basename( AMP__DIR__ ) . '/languages' ); + add_rewrite_endpoint( amp_get_slug(), EP_PERMALINK ); AMP_Theme_Support::init(); diff --git a/includes/admin/class-amp-editor-blocks.php b/includes/admin/class-amp-editor-blocks.php index f54590ea13f..1f05d52c881 100644 --- a/includes/admin/class-amp-editor-blocks.php +++ b/includes/admin/class-amp-editor-blocks.php @@ -107,7 +107,7 @@ public function enqueue_block_editor_assets() { wp_add_inline_script( 'amp-editor-blocks', - 'wp.i18n.setLocaleData( ' . wp_json_encode( gutenberg_get_jed_locale_data( 'amp' ) ) . ', "amp" );' . sprintf( 'ampEditorBlocks.boot();' ), + 'wp.i18n.setLocaleData( ' . wp_json_encode( gutenberg_get_jed_locale_data( 'amp-js' ) ) . ', "amp" );' . sprintf( 'ampEditorBlocks.boot();' ), 'before' ); } diff --git a/languages/amp-js.pot b/languages/amp-js.pot new file mode 100644 index 00000000000..9cf941a6bf0 --- /dev/null +++ b/languages/amp-js.pot @@ -0,0 +1,4 @@ +msgid "" +msgstr "" +"Content-Type: text/plain; charset=utf-8\n" +"X-Generator: babel-plugin-makepot\n"