how to use i18n for one language cakephp

微笑、不失礼 提交于 2019-12-11 03:28:46

问题


how do I setup i18n just to translate to spanish? I don't want user to change languages on the app, so I just need users to see the app in spanish...

I think don't need any routing... am I correct?


回答1:


If your website only has a single language, just write your spanish text directly into your view files where it's needed. No need to double the work.

If you still want to go with English text in the view files and a Spanish .po file, just set up your app according to the documentation and put this in your core.php to fix the language to Spanish:

Configure::write('Config.language', 'es');

In the views:

__('Hi!');

In your translation file:

msgid "Hi!"
msgstr "¡Hola!"


来源:https://stackoverflow.com/questions/4318204/how-to-use-i18n-for-one-language-cakephp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!