LoginSignup
1
0

More than 3 years have passed since last update.

【WordPress】多言語テーマ 翻訳されない【KUSANAGI】

Posted at

はじめに

久しぶりの投稿!!
KUSANAGI環境のWordPressで多言語テーマの翻訳ファイルが適応されない状態だったのを解決した。

結論

余計な説明を省いて結論!

WordPressの管理画面で、[KUSANAGI] > [翻訳アクセラレーター] の [サイトに表示される翻訳された文章] が
[翻訳を停止] になっているところを [通常翻訳] に変更。

以上!

デフォルトが停止?

デフォルトなのかもしれないし、
もしかしたら何かしらの設定でそうなっていたのかも?
もう一度入れ直したらわかるんだろうけど、検証はしていない!!

キャッシュ問題

KUSANAGIの売りのキャッシュを利用する際に、翻訳ファイルを読み込まないようになっているようだ。

function load_textdomain で キャッシュを優先に読み込むためのところでreturnがかかっていた。

    $plugin_override = apply_filters( 'override_load_textdomain', false, $domain, $mofile );

    if ( true == $plugin_override ) {
        unset( $l10n_unloaded[ $domain ] );

        return true;
    }

オーバーライド!!
KUSANAGIのコアファイルを検索すると…

# find . -name "*.php" | xargs grep override_load_textdomain
./DocumentRoot/wp-content/mu-plugins/kusanagi-core/modules/translate-accelerator.php:           add_filter( 'override_load_textdomain', array( $this, 'load_textdomain' ), 10, 3 );

ビンゴ!
これがどこを読み込んでいるかというと、上記の結論のとおりの設定だったとさ。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0