如何使用i18n的一种语言cakephp [英] how to use i18n for one language cakephp

查看:157
本文介绍了如何使用i18n的一种语言cakephp的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置i18n只是为了翻译成西班牙语?
我不想让用户在应用程序上更改语言,所以我只需要用户看到西班牙语的应用程序...

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

推荐答案

如果您的网站只有一种语言,只需输入您的西班牙文字直接进入你需要的视图文件。

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.

如果您仍想在视图文件和西班牙语.po文件中使用英文文本,只需设置您的应用根据文档,并把它放在你的 core.php 将语言修复为西班牙语:

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');

在视图中:

__('Hi!');

在您的翻译文件中:

msgid "Hi!"
msgstr "¡Hola!"

这篇关于如何使用i18n的一种语言cakephp的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆