Skip to content

Commit

Permalink
Add separate locale for blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
miina committed May 24, 2018
1 parent c967dee commit 8ac7759
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
[
"@wordpress/babel-plugin-makepot",
{
"output": "languages/amp.pot"
"output": "languages/amp-js.pot"
}
]
],
Expand Down
3 changes: 3 additions & 0 deletions amp.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion includes/admin/class-amp-editor-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);
}
Expand Down
4 changes: 4 additions & 0 deletions languages/amp-js.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"X-Generator: babel-plugin-makepot\n"

1 comment on commit 8ac7759

@swissspidy
Copy link
Collaborator

@swissspidy swissspidy commented on 8ac7759 May 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for correct understanding: text domain != locale.

Please sign in to comment.