I18N problem with default language (FIXED)
Hi,
I've noticed that the google bot indexed the language keys instead of
the translation. I could reproduce this by doing a telnet and a
"GET /" (it doesn't matter what site).
CakePHP caches the language files and for some reason it tried to load
"cake_core_default_en_us" instead of the default language. It didn't
matter if I chose "deu" or "eng" as default language - it always
loaded en_us. The bad thing is that Cake caches [LC_MESSAGES]
[$my_default_language][default] as an empty array instead of trying to
load the correct language and so it doesn't translate.
The function I18n::translate() has this array in $_this->__domains.
For that reason it's not trying to translate it.
The problem could be "solved" by copying the cache file
"cake_core_default_$my_default_language" to "cake_core_default_en_us".
I could also "fix" it by changing the line "if (!isset($_this-
>__domains[$_this->category][$_this->__lang][$domain])) {" to "if (!
isset($_this->__domains[$_this->category][$_this->__lang][$domain]) ||
sizeof($_this->__domains[$_this->category][$_this->__lang][$domain] ==
0)) {".
So I have forced cake to re-read the language file if it doesn't
contain anything.
This happened with CakePHP 1.2.6 as well as 1.2.7.
But enough of this blah. The problem was, that I've used __() in
bootstrap.php - which was obviously bad, because Cake didn't know
anything about the default language *doh*. I don't think it's a real
bug, but it may be considered somewhere.
cheers,
massl
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home