diff --git a/inc/vk-blocks/vk-blocks-functions.php b/inc/vk-blocks/vk-blocks-functions.php
index 0af5c2970..01f0ac87c 100644
--- a/inc/vk-blocks/vk-blocks-functions.php
+++ b/inc/vk-blocks/vk-blocks-functions.php
@@ -55,12 +55,30 @@ function vk_blocks_active() {
return true;
}
+// 翻訳を実行
add_action(
'plugins_loaded',
function () {
- // Load language files.
- $path = dirname( plugin_basename( __FILE__ ) ) . '/languages';
- load_plugin_textdomain( 'vk-blocks-pro', false, $path );
+ // サイトのロケールを取得
+ $locale = determine_locale();
+ // 翻訳ファイルのパスを指定
+ $path = plugin_dir_path( __FILE__ ) . 'languages';
+
+ // 日本語の設定のみ翻訳ファイルを読み込み
+ if ( strpos( $locale, 'ja' ) === 0 ) {
+ // PHPファイルの翻訳読み込み
+ load_textdomain( 'vk-blocks-pro', $path . '/vk-blocks-pro-ja.mo' );
+
+ // JavaScriptファイルの翻訳設定
+ add_action(
+ 'wp_enqueue_scripts',
+ function () use ( $path ) {
+ // スクリプト登録後に翻訳設定
+ wp_set_script_translations( 'vk-blocks-build-js', 'vk-blocks-pro', $path );
+ wp_set_script_translations( 'vk-blocks-admin-js', 'vk-blocks-pro', $path );
+ }
+ );
+ }
}
);
diff --git a/readme.txt b/readme.txt
index dd9948ebd..0b0aa4014 100644
--- a/readme.txt
+++ b/readme.txt
@@ -106,6 +106,7 @@ e.g.
== Changelog ==
+[ Specification change ] Adjusted translation file loading to comply with changes in WordPress 6.7.
[ Bug fix ][ Table of Contents (Pro) ] Fixed "CLOSE" label not appearing after clicking the "OPEN" button when the initial state is set to "CLOSE".
= 1.90.1 =
diff --git a/src/blocks/faq/deprecated/0.0.0/save.js b/src/blocks/faq/deprecated/0.0.0/save.js
deleted file mode 100644
index 892ec2261..000000000
--- a/src/blocks/faq/deprecated/0.0.0/save.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import { RichText } from '@wordpress/block-editor';
-
-export default function save({ attributes, className }) {
- const { heading, content } = attributes;
-
- return (
-
-
-
-
- );
-}
diff --git a/src/blocks/faq/deprecated/0.0.1/save.js b/src/blocks/faq/deprecated/0.0.1/save.js
deleted file mode 100644
index 4d5f3b158..000000000
--- a/src/blocks/faq/deprecated/0.0.1/save.js
+++ /dev/null
@@ -1,20 +0,0 @@
-import { RichText } from '@wordpress/block-editor';
-
-export default function save({ attributes }) {
- const { heading, content } = attributes;
-
- return (
-
-
-
-
- );
-}
diff --git a/src/blocks/faq/deprecated/0.0.2/save.js b/src/blocks/faq/deprecated/0.0.2/save.js
deleted file mode 100644
index 22ca87f96..000000000
--- a/src/blocks/faq/deprecated/0.0.2/save.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { RichText, InnerBlocks } from '@wordpress/block-editor';
-
-export default function save({ attributes }) {
- const { heading } = attributes;
- return (
-
-
- -
-
-
-
- );
-}
diff --git a/src/blocks/faq/deprecated/0.58.6/save.js b/src/blocks/faq/deprecated/0.58.6/save.js
deleted file mode 100644
index 20a4c424b..000000000
--- a/src/blocks/faq/deprecated/0.58.6/save.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import { RichText, InnerBlocks } from '@wordpress/block-editor';
-
-export default function save({ attributes }) {
- const { heading } = attributes;
- return (
-
-
- -
-
-
-
- );
-}
diff --git a/src/blocks/faq/deprecated/index.js b/src/blocks/faq/deprecated/index.js
index 3502275dc..33be628fe 100644
--- a/src/blocks/faq/deprecated/index.js
+++ b/src/blocks/faq/deprecated/index.js
@@ -1,7 +1,3 @@
-import save000 from './0.0.0/save';
-import save001 from './0.0.1/save';
-import save002 from './0.0.2/save';
-import save0_58_6 from './0.58.6/save';
import save1_76_2 from './1.76.2/save';
const blockAttributes = {
@@ -18,26 +14,6 @@ const blockAttributes = {
};
const deprecated = [
- {
- attributes: blockAttributes,
- save: save000,
- },
- {
- attributes: blockAttributes,
- save: save001,
- },
- {
- attributes: {
- ...blockAttributes,
- },
- save: save002,
- },
- {
- attributes: {
- ...blockAttributes,
- },
- save: save0_58_6,
- },
{
attributes: {
...blockAttributes,
diff --git a/src/blocks/faq2-a/deprecated/0.58.7/save.js b/src/blocks/faq2-a/deprecated/0.58.7/save.js
deleted file mode 100644
index 15b616d49..000000000
--- a/src/blocks/faq2-a/deprecated/0.58.7/save.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import { InnerBlocks } from '@wordpress/block-editor';
-
-export default function save() {
- return (
-
-
-
- );
-}
diff --git a/src/blocks/faq2-a/deprecated/index.js b/src/blocks/faq2-a/deprecated/index.js
index ebeb98acd..941ba0e2f 100644
--- a/src/blocks/faq2-a/deprecated/index.js
+++ b/src/blocks/faq2-a/deprecated/index.js
@@ -1,4 +1,3 @@
-import save000 from './0.58.7/save';
import save1_76_2 from './1.76.2/save';
const blockAttributes = {};
@@ -8,9 +7,5 @@ const deprecated = [
attributes: blockAttributes,
save: save1_76_2,
},
- {
- attributes: blockAttributes,
- save: save000,
- },
];
export default deprecated;
diff --git a/src/blocks/faq2-q/deprecated/0.58.7/save.js b/src/blocks/faq2-q/deprecated/0.58.7/save.js
deleted file mode 100644
index 92316bc8c..000000000
--- a/src/blocks/faq2-q/deprecated/0.58.7/save.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import { InnerBlocks } from '@wordpress/block-editor';
-
-export default function save() {
- return (
-
-
-
- );
-}
diff --git a/src/blocks/faq2-q/deprecated/index.js b/src/blocks/faq2-q/deprecated/index.js
index 3f13a9046..941ba0e2f 100644
--- a/src/blocks/faq2-q/deprecated/index.js
+++ b/src/blocks/faq2-q/deprecated/index.js
@@ -1,13 +1,8 @@
-import save000 from './0.58.7/save';
import save1_76_2 from './1.76.2/save';
const blockAttributes = {};
const deprecated = [
- {
- attributes: blockAttributes,
- save: save000,
- },
{
attributes: blockAttributes,
save: save1_76_2,
diff --git a/src/blocks/faq2/deprecated/0.0.0/save.js b/src/blocks/faq2/deprecated/0.0.0/save.js
deleted file mode 100644
index bd5defd1c..000000000
--- a/src/blocks/faq2/deprecated/0.0.0/save.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import { InnerBlocks } from '@wordpress/block-editor';
-
-export default function save() {
- return (
-
-
-
- );
-}
diff --git a/src/blocks/faq2/deprecated/index.js b/src/blocks/faq2/deprecated/index.js
index 229186b16..047439a9e 100644
--- a/src/blocks/faq2/deprecated/index.js
+++ b/src/blocks/faq2/deprecated/index.js
@@ -1,4 +1,3 @@
-import save000 from './0.0.0/save';
import save1_3_9 from './1.3.9/save';
import save1_76_2 from './1.76.2/save';
const blockAttributes = {
@@ -20,10 +19,6 @@ const deprecated = [
{
attributes: blockAttributes,
save: save1_3_9,
- },
- {
- attributes: blockAttributes,
- save: save000,
}
];
export default deprecated;
diff --git a/src/blocks/flow/deprecated/0.0.0/save.js b/src/blocks/flow/deprecated/0.0.0/save.js
deleted file mode 100644
index dd913b488..000000000
--- a/src/blocks/flow/deprecated/0.0.0/save.js
+++ /dev/null
@@ -1,31 +0,0 @@
-import { RichText } from '@wordpress/block-editor';
-
-export default function save({ attributes }) {
- const { heading, content, insertImage, arrowFlag } = attributes;
-
- return (
-
-
-
-
-
-
- {insertImage ? (
-
-
-
- ) : (
- ''
- )}
-
-
- );
-}
diff --git a/src/blocks/flow/deprecated/index.js b/src/blocks/flow/deprecated/index.js
index 71a087f94..326c60d01 100644
--- a/src/blocks/flow/deprecated/index.js
+++ b/src/blocks/flow/deprecated/index.js
@@ -1,4 +1,3 @@
-import save000 from './0.0.0/save';
import save1_8_0 from './1.8.0/save';
@@ -28,9 +27,5 @@ const deprecated = [
attributes: blockAttributes,
save: save1_8_0,
},
- {
- attributes: blockAttributes,
- save: save000,
- },
];
export default deprecated;
diff --git a/src/blocks/spacer/deprecated/0.0.0/component.js b/src/blocks/spacer/deprecated/0.0.0/component.js
deleted file mode 100644
index f0ef2a1c7..000000000
--- a/src/blocks/spacer/deprecated/0.0.0/component.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import { Component } from '@wordpress/element';
-
-export class SpacerComponent extends Component {
-
- render() {
- const {
- unit,
- pc,
- tablet,
- mobile,
- } = this.props.attributes;
-
- return (
-
- );
- }
-}
diff --git a/src/blocks/spacer/deprecated/0.0.0/save.js b/src/blocks/spacer/deprecated/0.0.0/save.js
deleted file mode 100644
index 1fd966da6..000000000
--- a/src/blocks/spacer/deprecated/0.0.0/save.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import { SpacerComponent } from "./component";
-
-export default function save({ attributes }) {
- return (
-
- );
-}
diff --git a/src/blocks/spacer/deprecated/0.0.1/component.js b/src/blocks/spacer/deprecated/0.0.1/component.js
deleted file mode 100644
index 83ff6a672..000000000
--- a/src/blocks/spacer/deprecated/0.0.1/component.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import { Component } from '@wordpress/element';
-
-export class SpacerComponent extends Component {
-
- render() {
- const {
- unit,
- pc,
- tablet,
- mobile,
- } = this.props.attributes;
- const className = this.props.className;
-
- return (
-
- );
- }
-}
diff --git a/src/blocks/spacer/deprecated/0.0.1/save.js b/src/blocks/spacer/deprecated/0.0.1/save.js
deleted file mode 100644
index 1fd966da6..000000000
--- a/src/blocks/spacer/deprecated/0.0.1/save.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import { SpacerComponent } from "./component";
-
-export default function save({ attributes }) {
- return (
-
- );
-}
diff --git a/src/blocks/spacer/deprecated/0.0.2/component.js b/src/blocks/spacer/deprecated/0.0.2/component.js
deleted file mode 100644
index b08ecb367..000000000
--- a/src/blocks/spacer/deprecated/0.0.2/component.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import { Component } from '@wordpress/element';
-import classNames from "classnames";
-
-export class SpacerComponent extends Component {
-
- render() {
- const {
- anchor,
- unit,
- pc,
- tablet,
- mobile,
- } = this.props.attributes;
- const className = this.props.className;
-
- return (
-
- );
- }
-}
diff --git a/src/blocks/spacer/deprecated/0.0.2/save.js b/src/blocks/spacer/deprecated/0.0.2/save.js
deleted file mode 100644
index 1fd966da6..000000000
--- a/src/blocks/spacer/deprecated/0.0.2/save.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import { SpacerComponent } from "./component";
-
-export default function save({ attributes }) {
- return (
-
- );
-}
diff --git a/src/blocks/spacer/deprecated/0.57.4/component.js b/src/blocks/spacer/deprecated/0.57.4/component.js
deleted file mode 100644
index cdb88c0e0..000000000
--- a/src/blocks/spacer/deprecated/0.57.4/component.js
+++ /dev/null
@@ -1,34 +0,0 @@
-import { Component } from '@wordpress/element';
-import classNames from 'classnames';
-
-export class SpacerComponent extends Component {
-
- render() {
- const {
- anchor,
- spaceType,
- unit,
- pc,
- tablet,
- mobile,
- } = this.props.attributes;
- const className = this.props.className;
- if ( spaceType === 'height') {
- return (
-
- );
- } else if ( spaceType === 'margin-top') {
- return (
-
- );
- }
- }
-}
diff --git a/src/blocks/spacer/deprecated/0.57.4/save.js b/src/blocks/spacer/deprecated/0.57.4/save.js
deleted file mode 100644
index 1fd966da6..000000000
--- a/src/blocks/spacer/deprecated/0.57.4/save.js
+++ /dev/null
@@ -1,7 +0,0 @@
-import { SpacerComponent } from "./component";
-
-export default function save({ attributes }) {
- return (
-
- );
-}
diff --git a/src/blocks/spacer/deprecated/0.57.4/schema.js b/src/blocks/spacer/deprecated/0.57.4/schema.js
deleted file mode 100644
index 1fede51f3..000000000
--- a/src/blocks/spacer/deprecated/0.57.4/schema.js
+++ /dev/null
@@ -1,35 +0,0 @@
-export const schema = {
- anchor: {
- type: 'string',
- default: null,
- },
- spaceType: {
- type: 'string',
- default: 'height',
- },
- unit: {
- type: 'string',
- default: 'px',
- },
- pc: {
- type: 'number',
- default: 40,
- },
- tablet: {
- type: 'number',
- default: 30,
- },
- mobile: {
- type: 'number',
- default: 20,
- },
-};
-
-export const example = {
- anchor: null,
- spaceType: 'height',
- unit: 'px',
- pc: 40,
- tablet: 30,
- mobile: 20
-};
diff --git a/src/blocks/spacer/deprecated/index.js b/src/blocks/spacer/deprecated/index.js
index 0b7069ea8..7de01ab43 100644
--- a/src/blocks/spacer/deprecated/index.js
+++ b/src/blocks/spacer/deprecated/index.js
@@ -1,7 +1,3 @@
-import save000 from './0.0.0/save';
-import save001 from './0.0.1/save';
-import save002 from './0.0.2/save';
-import save0_57_4 from './0.57.4/save';
import save1_3_2 from './1.3.2/save';
import save1_13_2 from './1.13.2/save';
import save1_25_1 from './1.25.1/save';
@@ -80,22 +76,6 @@ const deprecated = [
attributes:blockAttributes2,
save: save1_3_2,
},
- {
- attributes: blockAttributes2,
- save: save0_57_4,
- },
- {
- attributes: blockAttributes2,
- save: save002,
- },
- {
- attributes: blockAttributes,
- save: save001,
- },
- {
- attributes: blockAttributes,
- save: save000,
- },
];
export default deprecated;
diff --git a/src/blocks/staff/deprecated/0.58/component.js b/src/blocks/staff/deprecated/0.58/component.js
deleted file mode 100644
index 731d1c5a8..000000000
--- a/src/blocks/staff/deprecated/0.58/component.js
+++ /dev/null
@@ -1,153 +0,0 @@
-import { __ } from '@wordpress/i18n';
-import { Button } from '@wordpress/components';
-import { Component } from '@wordpress/element';
-import { RichText, MediaUpload } from '@wordpress/block-editor';
-
-export class NewComponent extends Component {
-
- render() {
-
- const {
- vk_staff_text_name,
- vk_staff_text_caption,
- vk_staff_text_role,
- vk_staff_text_profileTitle,
- vk_staff_text_profileText,
- vk_staff_photo_image,
- vk_staff_photo_image_alt,
- vk_staff_layout,
- vk_staff_nameColor,
- vk_staff_captionColor,
- vk_staff_positionColor,
- vk_staff_profileTitleColor,
- vk_staff_profileTextColor,
- vk_staff_photoBorder,
- vk_staff_fontFamily
- } = this.props.attributes;
- const setAttributes = this.props.setAttributes;
- const className = this.props.className;
- const for_ = this.props.for_;
- let returnELm = '';
-
- let staffTextClassName = 'vk_staff_text';
- if (vk_staff_fontFamily === '1') {
- staffTextClassName = classnames(
- staffTextClassName,
- 'vk_staff-headingFont-serif'
- );
- }
-
- if (for_ === 'edit') {
-
- returnELm =
-
- setAttributes({ vk_staff_text_name: value }) }
- value={ vk_staff_text_name }
- placeholder={ __('Your Name', 'vk-blocks-pro') }
- />
- setAttributes({ vk_staff_text_caption: value }) }
- value={ vk_staff_text_caption }
- placeholder={ __('Caption', 'vk-blocks-pro') }
- />
- setAttributes({ vk_staff_text_role: value }) }
- value={ vk_staff_text_role }
- placeholder={ __('Role position', 'vk-blocks-pro') }
- />
- setAttributes({ vk_staff_text_profileTitle: value }) }
- value={ vk_staff_text_profileTitle }
- placeholder={ __('Profile title', 'vk-blocks-pro') }
- />
- setAttributes({ vk_staff_text_profileText: value }) }
- value={ vk_staff_text_profileText }
- placeholder={ __('Profile text', 'vk-blocks-pro') }
- />
-
-
-
setAttributes({ vk_staff_photo_image: value.sizes.full.url }) }
- type="image"
- className={ 'vk_staff_photo_image' }
- value={ vk_staff_photo_image }
- render={ ({ open }) => (
-
- ) }
- />
-
-
;
-
- } else if (for_ === 'save') {
-
- returnELm =
-
-
-
-
-
-
-
- { vk_staff_photo_image ?
-
-
-
- : ''
- }
-
;
- }
- return (returnELm);
- }
-}
diff --git a/src/blocks/staff/deprecated/0.58/save.js b/src/blocks/staff/deprecated/0.58/save.js
deleted file mode 100644
index 3e7f94e24..000000000
--- a/src/blocks/staff/deprecated/0.58/save.js
+++ /dev/null
@@ -1,12 +0,0 @@
-import { NewComponent } from "./component";
-
-export default function save({ attributes }) {
- return (
-
- );
-}
diff --git a/src/blocks/staff/deprecated/index.js b/src/blocks/staff/deprecated/index.js
index b29e62dfc..715f504fa 100644
--- a/src/blocks/staff/deprecated/index.js
+++ b/src/blocks/staff/deprecated/index.js
@@ -1,6 +1,5 @@
import save1_20_2 from './1.20.2/save';
import save1_3_1 from './1.3.1/save';
-import save0_58 from './0.58/save';
export const blockAttributes = {
vk_staff_text_name: {
@@ -82,10 +81,6 @@ const deprecated = [
{
attributes: blockAttributes2,
save: save1_3_1
- },
- {
- attributes: blockAttributes,
- save: save0_58
}
];
diff --git a/test/e2e-tests/fixtures/blocks/vk-blocks__faq2__deprecated-0-60-1.html b/test/e2e-tests/fixtures/blocks/vk-blocks__faq2__deprecated-0-60-1.html
deleted file mode 100644
index 20b413dd2..000000000
--- a/test/e2e-tests/fixtures/blocks/vk-blocks__faq2__deprecated-0-60-1.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
- -
-
質問を入力してください
-
-
-
-
- -
-
回答を入力してください
-
-
-
\ No newline at end of file
diff --git a/test/e2e-tests/fixtures/blocks/vk-blocks__faq__deprecated-0-60-1.html b/test/e2e-tests/fixtures/blocks/vk-blocks__faq__deprecated-0-60-1.html
deleted file mode 100644
index 6f46bd3d9..000000000
--- a/test/e2e-tests/fixtures/blocks/vk-blocks__faq__deprecated-0-60-1.html
+++ /dev/null
@@ -1,5 +0,0 @@
-
-- 質問を入力
-
-
回答を入力してください。
-
-
\ No newline at end of file
diff --git a/test/e2e-tests/fixtures/blocks/vk-blocks__flow__deprecated-0-60-1.html b/test/e2e-tests/fixtures/blocks/vk-blocks__flow__deprecated-0-60-1.html
deleted file mode 100644
index e6a0a772f..000000000
--- a/test/e2e-tests/fixtures/blocks/vk-blocks__flow__deprecated-0-60-1.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/test/e2e-tests/fixtures/blocks/vk-blocks__spacer__deprecated-0-60-1.html b/test/e2e-tests/fixtures/blocks/vk-blocks__spacer__deprecated-0-60-1.html
deleted file mode 100644
index cdf50dd61..000000000
--- a/test/e2e-tests/fixtures/blocks/vk-blocks__spacer__deprecated-0-60-1.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/test/e2e-tests/fixtures/blocks/vk-blocks__spacer__deprecated-0-60-1__has_ID_margin-top.html b/test/e2e-tests/fixtures/blocks/vk-blocks__spacer__deprecated-0-60-1__has_ID_margin-top.html
deleted file mode 100644
index 8f6b61f3e..000000000
--- a/test/e2e-tests/fixtures/blocks/vk-blocks__spacer__deprecated-0-60-1__has_ID_margin-top.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/test/e2e-tests/fixtures/blocks/vk-blocks__staff__deprecated-0-60-1.html b/test/e2e-tests/fixtures/blocks/vk-blocks__staff__deprecated-0-60-1.html
deleted file mode 100644
index e59b0a27e..000000000
--- a/test/e2e-tests/fixtures/blocks/vk-blocks__staff__deprecated-0-60-1.html
+++ /dev/null
@@ -1,3 +0,0 @@
-
-山田太郎
Yamada Tarou
代表取締役
プロフィール
名古屋のウェブ制作会社数社に10年程度務めた後、株式会社ベクトル設立。
企画・運営・コンサルティング〜WordPressを中心としたシステム開発まで幅広く携わる。
-
\ No newline at end of file
diff --git a/test/e2e/heading-transform.spec.ts b/test/e2e/heading-transform.spec.ts
index b06ed9d18..ba868bf92 100644
--- a/test/e2e/heading-transform.spec.ts
+++ b/test/e2e/heading-transform.spec.ts
@@ -52,7 +52,7 @@ test.describe( 'Block', () => {
// 変換内容
await expect( page.locator( '.wp-block-heading' ) ).toHaveClass(
- 'block-editor-rich-text__editable block-editor-block-list__block wp-block is-multi-selected wp-elements-0 has-contrast-color has-text-color wp-block-heading rich-text'
+ 'block-editor-rich-text__editable block-editor-block-list__block wp-block is-multi-selected wp-elements-0 has-accent-1-color has-text-color wp-block-heading rich-text'
);
await expect( page.locator( '.wp-block-heading' ) ).toHaveCSS(
'margin-bottom',
@@ -60,10 +60,10 @@ test.describe( 'Block', () => {
);
await expect( page.locator( 'p.has-text-color' ) ).toHaveCSS(
'font-size',
- '32px'
+ '31.2896px'
);
await expect( page.locator( '.wp-block-heading' ) ).toHaveClass(
- 'block-editor-rich-text__editable block-editor-block-list__block wp-block is-multi-selected wp-elements-0 has-contrast-color has-text-color wp-block-heading rich-text'
+ 'block-editor-rich-text__editable block-editor-block-list__block wp-block is-multi-selected wp-elements-0 has-accent-1-color has-text-color wp-block-heading rich-text'
);
await expect( page.locator( '.wp-block-heading' ) ).toHaveCSS(
'margin-bottom',
@@ -71,7 +71,7 @@ test.describe( 'Block', () => {
);
await expect( page.locator( 'p.has-text-color' ) ).toHaveCSS(
'font-size',
- '32px'
+ '31.2896px'
);
} );
diff --git a/vk-blocks.php b/vk-blocks.php
index 9a64ec0dd..f09423e36 100644
--- a/vk-blocks.php
+++ b/vk-blocks.php
@@ -153,9 +153,26 @@ function vk_blocks_is_pro() {
add_action(
'plugins_loaded',
function () {
- // Load language files.
- $path = dirname( plugin_basename( __FILE__ ) ) . '/languages';
- load_plugin_textdomain( 'vk-blocks-pro', false, $path );
+ // サイトのロケールを取得
+ $locale = determine_locale();
+ // 翻訳ファイルのパスを指定
+ $path = plugin_dir_path( __FILE__ ) . 'languages';
+
+ // 日本語の設定のみ翻訳ファイルを読み込み
+ if ( strpos( $locale, 'ja' ) === 0 ) {
+ // PHPファイルの翻訳読み込み
+ load_textdomain( 'vk-blocks-pro', $path . '/vk-blocks-pro-ja.mo' );
+
+ // JavaScriptファイルの翻訳設定
+ add_action(
+ 'wp_enqueue_scripts',
+ function () use ( $path ) {
+ // スクリプト登録後に翻訳設定
+ wp_set_script_translations( 'vk-blocks-build-js', 'vk-blocks-pro', $path );
+ wp_set_script_translations( 'vk-blocks-admin-js', 'vk-blocks-pro', $path );
+ }
+ );
+ }
}
);