我在网站上设置本地化,但我遇到了一些麻烦。
我找到了一个教程,这正是我需要的: a href =nuts-and-bolts-of-cakephp/2008/11/28/cakephp-url-based-language-switching-for-i18n-and-l10n-internationalization-and-localization/ rel =nofollow> nuts-and-bolts-of-cakephp/2008/11/28/cakephp-url-based-language-switching-for-i18n-and-l10n-internationalization-and -localization / (直接使用主机名后的语言)。
所以我做了这个网站上写的一切: / p>
我的链接生成的很好,我没有任何异常/错误,我的本地文件是可读的,但是当我去模板,我试图使用variable()我只是看到testTranslation作为文本,没有翻译的文本。
这不工作?看起来找不到我的文件,但我不知道为什么:(
任何帮助将非常感激!
编辑:我用cakePhp做了一些调试,看起来当调用i18n.php文件的方法translate时,我收到一个$ domain = default_ger var。我的翻译都在default.po文件中,并且我想他正在搜索default_ger.po?为什么这个?我怎么能强迫它读取default.po文件?
编辑:我发现了一些东西:我有一个问题,我的控制器,我忘了在我的孩子控制器中声明parent :: beforeFilter(),然后在控制器中的方法没有被调用,并且语言总是德国的一个。和英语工作正常,但德国仍然只显示关键,而不是我在翻译文件中的值这是真的很奇怪,我删除了缓存中的所有文件,删除我的/ app / locale / ger文件夹,并将我的/ app / locale / fre复制到/ app / locale / ger(不更改任何文件),这仍然不工作。什么可以不同?
解决方案我终于找到了问题:
因为德语总是被使用的(因为当将语言改为德语时它会工作一次,并通过cookie注册它)。
除德语之外的所有其他语言正在正确显示我的值。
所以我搜索这个问题,我试图使用deu而不是ger
语言环境文件夹必须是deu,语言值可以是deu或ger。
这很奇怪,因为对于法语,我有一个fre(FREnch),而不是fra(FRAnçais),这是工作。
无论如何,这个工作与此更改I'm setting the localization on a website, but I've some trouble.
I've found a tutorial, which does exactly what I need: nuts-and-bolts-of-cakephp/2008/11/28/cakephp-url-based-language-switching-for-i18n-and-l10n-internationalization-and-localization/ (having directly the language after the hostname).
So I've done everything which is written on this website:
My links are well generated, I don't have any exception/errors, my locals files are readable, but when I go on the template where I try to use variable( ) I just see "testTranslation" as text, no translated text.
Why this isn't working? Looks like it can't find my files but I don't know why :(
Any help would be really appreciated!
Edit: I did some debugging with cakePhp, and it appears that when the method translate of the i18n.php file is called, I receive a $domain = default_ger var. My translations are all in default.po files, and I suppose that he is searching into default_ger.po? why this? how can i force it to read in the default.po file?
Edit: I found something: I had a problem with my controller, I forgot to declare the parent::beforeFilter() in my children controller, then the method in the controller wasn't called and the language was always the german one. After I fixed this, the french and the english are working fine, but the german is still only displaying key and not values that I've in the translation file. This is really weird, I've deleted all files in the cache, deleted my /app/locale/ger folder and copied my /app/locale/fre to /app/locale/ger(without changing anything in files) and this still doesn't work. What can be different?
解决方案I finally found the problem:
My App controller wasn't called, so the German language was always used(because it worked once when changing the language to german, and register it through cookies).
All other languages than german were displaying correctly my values.
So I searched about this problem, and I tried to use "deu" instead of "ger", and it worked!
The locale folder has to be "deu", the language value can be deu or ger.
This is very strange, because for the french, I've a "fre"(FREnch) and not a "fra"(FRAnçais), and this is working.
Anyway, this work with this change
更多推荐
CakePp本地化
发布评论