diff --git a/assets/js/src/definition-description.jsx b/assets/js/src/definition-description.jsx index a5c83df..e6bfced 100644 --- a/assets/js/src/definition-description.jsx +++ b/assets/js/src/definition-description.jsx @@ -1,11 +1,12 @@ const { registerBlockType } = wp.blocks; const { RichText } = wp.editor; +const { __ } = wp.i18n; + -/* global YomiganaDd: false */ registerBlockType( 'wp-yomigana/description', { - title: YomiganaDd.label, + title: __( 'Description', 'wp-yomigana' ), icon: ( diff --git a/assets/js/src/definition-list.jsx b/assets/js/src/definition-list.jsx index 6d19969..5adfaf5 100644 --- a/assets/js/src/definition-list.jsx +++ b/assets/js/src/definition-list.jsx @@ -1,11 +1,10 @@ const { registerBlockType } = wp.blocks; const { InnerBlocks } = wp.editor; - -/* global YomiganaDl: false */ +const { __ } = wp.i18n; registerBlockType( 'wp-yomigana/dl', { - title: YomiganaDl.label, + title: __( 'Definition List', 'wp-yomigana' ), icon: ( @@ -38,4 +37,5 @@ registerBlockType( 'wp-yomigana/dl', { ) } + } ); diff --git a/assets/js/src/definition-term.jsx b/assets/js/src/definition-term.jsx index 418d24a..4587a3e 100644 --- a/assets/js/src/definition-term.jsx +++ b/assets/js/src/definition-term.jsx @@ -1,11 +1,11 @@ const { registerBlockType } = wp.blocks; -const { RichText } = wp.editor; +const { RichText } = wp.editor; +const { __ } = wp.i18n; -/* global YomiganaDt: false */ registerBlockType( 'wp-yomigana/term', { - title: YomiganaDt.label, + title: __( 'Term', 'wp-yomigana' ), icon: ( block-icons diff --git a/i18n/wp-yomigana-ja.mo b/i18n/wp-yomigana-ja.mo index 936bdb1..551ffda 100644 Binary files a/i18n/wp-yomigana-ja.mo and b/i18n/wp-yomigana-ja.mo differ diff --git a/i18n/wp-yomigana-ja.po b/i18n/wp-yomigana-ja.po index 3489729..64d917c 100644 --- a/i18n/wp-yomigana-ja.po +++ b/i18n/wp-yomigana-ja.po @@ -1,15 +1,15 @@ msgid "" msgstr "" "Project-Id-Version: \n" -"POT-Creation-Date: 2018-03-14 15:41+0900\n" -"PO-Revision-Date: 2018-03-15 02:16+0900\n" +"POT-Creation-Date: 2018-12-04 18:44+0900\n" +"PO-Revision-Date: 2018-12-04 19:51+0900\n" "Last-Translator: Takahashi Fumiki \n" "Language-Team: \n" "Language: ja\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.0.4\n" +"X-Generator: Poedit 2.2\n" "X-Poedit-Basepath: .\n" "Plural-Forms: nplurals=1; plural=0;\n" @@ -29,43 +29,44 @@ msgstr "ルビ設定" msgid "Setting" msgstr "設定" -#: src/Hametuha/Yomigana/Bootstrap.php:92 +#: src/Hametuha/Yomigana/Bootstrap.php:93 assets/js/src/definition-list.jsx:7 msgid "Definition List" msgstr "定義リスト" -#: src/Hametuha/Yomigana/Bootstrap.php:93 +#: src/Hametuha/Yomigana/Bootstrap.php:94 msgid "Apply / Strip" msgstr "適用 / 解除" -#: src/Hametuha/Yomigana/Bootstrap.php:94 +#: src/Hametuha/Yomigana/Bootstrap.php:95 msgid "Switch term and definition" msgstr "用語と定義を切り替え" -#: src/Hametuha/Yomigana/Bootstrap.php:95 +#: src/Hametuha/Yomigana/Bootstrap.php:96 msgid "Inline Quote" msgstr "インライン引用" -#: src/Hametuha/Yomigana/Bootstrap.php:97 +#: src/Hametuha/Yomigana/Bootstrap.php:98 msgid "Annotation" msgstr "注釈" -#: src/Hametuha/Yomigana/Bootstrap.php:98 +#: src/Hametuha/Yomigana/Bootstrap.php:99 msgid "Cite" msgstr "引用元" -#: src/Hametuha/Yomigana/Bootstrap.php:99 templates/ruby.php:14 +#: src/Hametuha/Yomigana/Bootstrap.php:100 templates/ruby.php:15 +#: assets/js/src/wp-yomigana-gutenberg.jsx:16 msgid "Ruby" msgstr "ルビ" -#: src/Hametuha/Yomigana/Bootstrap.php:102 +#: src/Hametuha/Yomigana/Bootstrap.php:103 msgid "Cancel" msgstr "キャンセル" -#: src/Hametuha/Yomigana/Bootstrap.php:103 +#: src/Hametuha/Yomigana/Bootstrap.php:104 msgid "OK" msgstr "OK" -#: src/Hametuha/Yomigana/Bootstrap.php:104 +#: src/Hametuha/Yomigana/Bootstrap.php:105 msgid "Delete" msgstr "削除" @@ -81,11 +82,11 @@ msgstr "引用文" msgid "Source / URL" msgstr "引用元 / URL" -#: templates/ruby.php:5 +#: templates/ruby.php:6 msgid "Enter ruby annotation." msgstr "ルビを入力してください。" -#: templates/ruby.php:8 +#: templates/ruby.php:9 msgid "Parent String" msgstr "親文字" @@ -125,6 +126,18 @@ msgstr "WP-Yomigana は PHP %1$s 以上が必須ですが、ご利用のPHPは % msgid "WP-Yomigana's auto load file %s is not found." msgstr "WP-Yomigana の オートロードファイル %s が見つかりません。" +#: assets/js/src/definition-description.jsx:8 +msgid "Description" +msgstr "説明" + +#: assets/js/src/definition-term.jsx:7 +msgid "Term" +msgstr "用語" + +#: assets/js/src/wp-yomigana-gutenberg.jsx:28 +msgid "Span" +msgstr "スパン" + #. Plugin Name of the plugin/theme msgid "WP-Yomigana" msgstr "WP-Yomigana" diff --git a/i18n/wp-yomigana.pot b/i18n/wp-yomigana.pot index e1d2a4c..81f282f 100644 --- a/i18n/wp-yomigana.pot +++ b/i18n/wp-yomigana.pot @@ -3,14 +3,14 @@ msgid "" msgstr "" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" "Project-Id-Version: WP-Yomigana\n" -"POT-Creation-Date: 2018-03-14 15:41+0900\n" +"POT-Creation-Date: 2018-12-04 19:51+0900\n" "PO-Revision-Date: 2018-03-13 02:41+0900\n" "Last-Translator: Takahashi Fumiki \n" "Language-Team: Takahashi Fumiki \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.0.4\n" +"X-Generator: Poedit 2.2\n" "X-Poedit-Basepath: ..\n" "X-Poedit-Flags-xgettext: --add-comments=translators:\n" "X-Poedit-WPHeader: wp-yomigana.php\n" @@ -19,10 +19,9 @@ msgstr "" "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;" "_n_noop:1,2;_nx_noop:3c,1,2;__ngettext_noop:1,2\n" "X-Poedit-SearchPath-0: .\n" -"X-Poedit-SearchPathExcluded-0: *.js\n" -"X-Poedit-SearchPathExcluded-1: assets\n" -"X-Poedit-SearchPathExcluded-2: node_modules\n" -"X-Poedit-SearchPathExcluded-3: vendor\n" +"X-Poedit-SearchPathExcluded-0: node_modules\n" +"X-Poedit-SearchPathExcluded-1: vendor\n" +"X-Poedit-SearchPathExcluded-2: assets/js/dist\n" #: src/Hametuha/Yomigana/Admin.php:48 msgid "Option has been updated." @@ -40,43 +39,44 @@ msgstr "" msgid "Setting" msgstr "" -#: src/Hametuha/Yomigana/Bootstrap.php:92 +#: src/Hametuha/Yomigana/Bootstrap.php:93 assets/js/src/definition-list.jsx:7 msgid "Definition List" msgstr "" -#: src/Hametuha/Yomigana/Bootstrap.php:93 +#: src/Hametuha/Yomigana/Bootstrap.php:94 msgid "Apply / Strip" msgstr "" -#: src/Hametuha/Yomigana/Bootstrap.php:94 +#: src/Hametuha/Yomigana/Bootstrap.php:95 msgid "Switch term and definition" msgstr "" -#: src/Hametuha/Yomigana/Bootstrap.php:95 +#: src/Hametuha/Yomigana/Bootstrap.php:96 msgid "Inline Quote" msgstr "" -#: src/Hametuha/Yomigana/Bootstrap.php:97 +#: src/Hametuha/Yomigana/Bootstrap.php:98 msgid "Annotation" msgstr "" -#: src/Hametuha/Yomigana/Bootstrap.php:98 +#: src/Hametuha/Yomigana/Bootstrap.php:99 msgid "Cite" msgstr "" -#: src/Hametuha/Yomigana/Bootstrap.php:99 templates/ruby.php:14 +#: src/Hametuha/Yomigana/Bootstrap.php:100 templates/ruby.php:15 +#: assets/js/src/wp-yomigana-gutenberg.jsx:16 msgid "Ruby" msgstr "" -#: src/Hametuha/Yomigana/Bootstrap.php:102 +#: src/Hametuha/Yomigana/Bootstrap.php:103 msgid "Cancel" msgstr "" -#: src/Hametuha/Yomigana/Bootstrap.php:103 +#: src/Hametuha/Yomigana/Bootstrap.php:104 msgid "OK" msgstr "" -#: src/Hametuha/Yomigana/Bootstrap.php:104 +#: src/Hametuha/Yomigana/Bootstrap.php:105 msgid "Delete" msgstr "" @@ -92,11 +92,11 @@ msgstr "" msgid "Source / URL" msgstr "" -#: templates/ruby.php:5 +#: templates/ruby.php:6 msgid "Enter ruby annotation." msgstr "" -#: templates/ruby.php:8 +#: templates/ruby.php:9 msgid "Parent String" msgstr "" @@ -136,6 +136,18 @@ msgstr "" msgid "WP-Yomigana's auto load file %s is not found." msgstr "" +#: assets/js/src/definition-description.jsx:8 +msgid "Description" +msgstr "" + +#: assets/js/src/definition-term.jsx:7 +msgid "Term" +msgstr "" + +#: assets/js/src/wp-yomigana-gutenberg.jsx:28 +msgid "Span" +msgstr "" + #. Plugin Name of the plugin/theme msgid "WP-Yomigana" msgstr "" diff --git a/src/Hametuha/Yomigana/Gutenberg.php b/src/Hametuha/Yomigana/Gutenberg.php index 7838c90..a82ea15 100644 --- a/src/Hametuha/Yomigana/Gutenberg.php +++ b/src/Hametuha/Yomigana/Gutenberg.php @@ -25,20 +25,24 @@ protected function __construct() { */ public function register_script() { // Register DL. - wp_register_script( 'wp-yomigana-dl', $this->assets . '/js/dist/definition-list.js', [ 'wp-blocks', 'wp-editor' ], self::VERSION, true ); - wp_localize_script( 'wp-yomigana-dl', 'YomiganaDl', [ - 'label' => __( 'Definition List', 'wp-yomigana' ), - ] ); - wp_register_style( 'wp-yomigana-dl', $this->assets . '/css/editor-dl.css', [], self::VERSION ); + wp_register_script( 'wp-yomigana-dl', $this->assets . '/js/dist/definition-list.js', [ 'wp-blocks', 'wp-editor', 'wp-i18n' ], self::VERSION, true ); + wp_register_style( 'wp-yomigana-dl', $this->assets . '/css/editor-dl.css', [ 'wp-blocks' ], self::VERSION ); // Register dt - wp_register_script( 'wp-yomigana-dt', $this->assets . '/js/dist/definition-term.js', [ 'wp-blocks', 'wp-editor' ], self::VERSION, true ); - wp_localize_script( 'wp-yomigana-dt', 'YomiganaDt', [ - 'label' => __( 'Term', 'wp-yomigana' ), - ] ); - wp_register_script( 'wp-yomigana-dd', $this->assets . '/js/dist/definition-description.js', [ 'wp-blocks', 'wp-editor' ], self::VERSION, true ); - wp_localize_script( 'wp-yomigana-dd', 'YomiganaDd', [ - 'label' => __( 'Description', 'wp-yomigana' ), - ] ); + wp_register_script( 'wp-yomigana-dt', $this->assets . '/js/dist/definition-term.js', [ 'wp-yomigana-dl' ], self::VERSION, true ); + // Register dd + wp_register_script( 'wp-yomigana-dd', $this->assets . '/js/dist/definition-description.js', [ 'wp-yomigana-dl' ], self::VERSION, true ); + // Register translation. + if ( function_exists( 'gutenberg_get_jed_locale_data' ) ) { + $json = json_encode( gutenberg_get_jed_locale_data( 'wp-yomigana' ) ); + wp_add_inline_script( + 'wp-yomigana-dl', + sprintf( 'wp.i18n.setLocaleData( %s, "wp-yomigana" );', $json ), + 'before' + ); + } + if ( function_exists( 'wp_set_script_translations' ) ) { + wp_set_script_translations( 'wp-yomigana-dl', 'wp-yomigana' ); + } } /**