LoginSignup
0
0

More than 1 year has passed since last update.

EC Cubeで英語対応

Posted at

経緯

「このサイト海外向けのサイトなので全部英語で管理画面は日本語にしてね」って以前言われましたので、ハマったポイントをメモとして公開します。

ポイント1

まず、.envファイルを書き換えればすべて英語になると思って書き換えたら管理画面しか英語にならなかった

/.env
#英語に変更
ECCUBE_LOCALE=en

↑実はEC Cubeからダウンロードできるデフォルトテーマは何故か英語対応されていないのでGithubからテーマをダウンロードする必要がある

ポイント2

管理画面は日本語にしたい
全ての管理画面を継承しているコントローラーに日本語設定にすれば良いというのは分かるが書き方が思いつかない...
調べた所ルーティングを管理している.yamlに記述すれば良いらしい

app/config/eccube/routes.yaml
# ユーザー側画面のルーティング
controllers:
    resource: ../../src/Eccube/Controller/
    type: annotation
    defaults:
         _locale: en
# 管理画面のルーティング
admin_controllers:
    resource: ../../src/Eccube/Controller/Admin/
    type: annotation
    defaults:
        _locale: ja

ポイント3

1と2で英語化できたと思ったが管理画面のプラグイン設定ページが英語になるものが出てきた。
なので最終的に下記のような設定に変更することで解決

/.env
#日本語に戻す
ECCUBE_LOCALE=ja
app/config/eccube/routes.yaml
# ユーザー側画面のルーティング
controllers:
    resource: ../../src/Eccube/Controller/
    type: annotation
    defaults:
         _locale: en
# 管理画面のルーティング
admin_controllers:
    resource: ../../src/Eccube/Controller/Admin/
    type: annotation
    defaults:
        _locale: ja

#customize_controllers「日本語にしなくても良いかも」
customize_controllers:
    resource: ../../app/Customize/Controller/
    type: annotation
    defaults:
         _locale: ja

感想

EC Cubeを理解するにはsymfonyを勉強する必要があるなと感じた

0
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
0
0