「Php/Symfony/Symfony2/翻訳」の版間の差分

提供: 初心者エンジニアの簡易メモ
ナビゲーションに移動 検索に移動
編集の要約なし
編集の要約なし
17行目: 17行目:
  user:
  user:
     login: Login
     login: Login
==翻訳cache削除==
php app/console cache:clear


==参考==
==参考==
http://docs.symfony.gr.jp/symfony2/book/translation.html
http://docs.symfony.gr.jp/symfony2/book/translation.html

2017年1月5日 (木) 07:44時点における版

phpの翻訳コード

echo $this->get('translator')->trans('Hello World');

言語設定変更方法

-app/config/config.yml

framework:
    translator: { fallback: en }

言語ファイル

-Resources/translations/message.en.yml

symfony2:
   is:
       great: Symfony2 is great
       amazing: Symfony2 is amazing
   has:
       bundles: Symfony2 has bundles
user:
   login: Login

翻訳cache削除

php app/console cache:clear

参考

http://docs.symfony.gr.jp/symfony2/book/translation.html