Updating l10n to use the new CakeRequest method.

This commit is contained in:
mark_story 2010-11-07 01:38:25 -04:00
parent 22bb07abb0
commit 09d3a0626a

View file

@ -17,6 +17,7 @@
* @since CakePHP(tm) v 1.2.0.4116 * @since CakePHP(tm) v 1.2.0.4116
* @license MIT License (http://www.opensource.org/licenses/mit-license.php) * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/ */
App::import('Core', 'CakeRequest');
/** /**
* Localization * Localization
@ -407,13 +408,8 @@ class L10n {
* @access private * @access private
*/ */
function __autoLanguage() { function __autoLanguage() {
$_detectableLanguages = preg_split('/[,;]/', env('HTTP_ACCEPT_LANGUAGE')); $_detectableLanguages = CakeRequest::acceptLanguage();
foreach ($_detectableLanguages as $key => $langKey) { foreach ($_detectableLanguages as $key => $langKey) {
$langKey = strtolower($langKey);
if (strpos($langKey, '_') !== false) {
$langKey = str_replace('_', '-', $langKey);
}
if (isset($this->__l10nCatalog[$langKey])) { if (isset($this->__l10nCatalog[$langKey])) {
$this->__setLanguage($langKey); $this->__setLanguage($langKey);
return true; return true;