Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ WP6.7 ] 日本語の翻訳が効いていなかったのを修正しました #2311

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions inc/vk-blocks/vk-blocks-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
);
}
}
);

Expand Down
1 change: 1 addition & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
20 changes: 0 additions & 20 deletions src/blocks/faq/deprecated/0.0.0/save.js

This file was deleted.

20 changes: 0 additions & 20 deletions src/blocks/faq/deprecated/0.0.1/save.js

This file was deleted.

17 changes: 0 additions & 17 deletions src/blocks/faq/deprecated/0.0.2/save.js

This file was deleted.

17 changes: 0 additions & 17 deletions src/blocks/faq/deprecated/0.58.6/save.js

This file was deleted.

24 changes: 0 additions & 24 deletions src/blocks/faq/deprecated/index.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -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,
Expand Down
9 changes: 0 additions & 9 deletions src/blocks/faq2-a/deprecated/0.58.7/save.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/blocks/faq2-a/deprecated/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import save000 from './0.58.7/save';
import save1_76_2 from './1.76.2/save';

const blockAttributes = {};
Expand All @@ -8,9 +7,5 @@ const deprecated = [
attributes: blockAttributes,
save: save1_76_2,
},
{
attributes: blockAttributes,
save: save000,
},
];
export default deprecated;
9 changes: 0 additions & 9 deletions src/blocks/faq2-q/deprecated/0.58.7/save.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/blocks/faq2-q/deprecated/index.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
9 changes: 0 additions & 9 deletions src/blocks/faq2/deprecated/0.0.0/save.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/blocks/faq2/deprecated/index.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -20,10 +19,6 @@ const deprecated = [
{
attributes: blockAttributes,
save: save1_3_9,
},
{
attributes: blockAttributes,
save: save000,
}
];
export default deprecated;
31 changes: 0 additions & 31 deletions src/blocks/flow/deprecated/0.0.0/save.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/blocks/flow/deprecated/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import save000 from './0.0.0/save';
import save1_8_0 from './1.8.0/save';


Expand Down Expand Up @@ -28,9 +27,5 @@ const deprecated = [
attributes: blockAttributes,
save: save1_8_0,
},
{
attributes: blockAttributes,
save: save000,
},
];
export default deprecated;
21 changes: 0 additions & 21 deletions src/blocks/spacer/deprecated/0.0.0/component.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/blocks/spacer/deprecated/0.0.0/save.js

This file was deleted.

22 changes: 0 additions & 22 deletions src/blocks/spacer/deprecated/0.0.1/component.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/blocks/spacer/deprecated/0.0.1/save.js

This file was deleted.

24 changes: 0 additions & 24 deletions src/blocks/spacer/deprecated/0.0.2/component.js

This file was deleted.

7 changes: 0 additions & 7 deletions src/blocks/spacer/deprecated/0.0.2/save.js

This file was deleted.

Loading
Loading