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

提供: 初心者エンジニアの簡易メモ
ナビゲーションに移動 検索に移動
ページの作成:「==phpの翻訳コード== echo $this->get('translator')->trans('Hello World'); ==言語設定変更方法== # app/config/config.yml framework: translator: { fallb...」
 
編集の要約なし
3行目: 3行目:


==言語設定変更方法==
==言語設定変更方法==
# app/config/config.yml
-app/config/config.yml
  framework:
  framework:
     translator: { fallback: en }
     translator: { fallback: en }


==言語ファイル==
==言語ファイル==
Resources/translations/message.en.yml
-Resources/translations/message.en.yml
  symfony2:
  symfony2:
     is:
     is:
17行目: 17行目:
  user:
  user:
     login: Login
     login: Login
==参考==
http://docs.symfony.gr.jp/symfony2/book/translation.html

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

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

参考

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