Skip to content
Permalink
Browse files

Updated I18n folder

  • Loading branch information...
jrbasso committed May 25, 2012
1 parent acb44bf commit 206aca5cd7b57733da865c7842df4d842cc29c50
Showing with 27 additions and 26 deletions.
  1. +9 −9 lib/Cake/I18n/I18n.php
  2. +4 −2 lib/Cake/I18n/L10n.php
  3. +14 −15 lib/Cake/I18n/Multibyte.php
@@ -16,13 +16,13 @@
* @since CakePHP(tm) v 1.2.0.4116
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
/**
* Included libraries.
*/
App::uses('CakePlugin', 'Core');
App::uses('L10n', 'I18n');
App::uses('Multibyte', 'I18n');
namespace Cake\I18n;
use Cake\Core\Configure,
Cake\Core\Plugin,
Cake\Core\App,
Cake\Cache\Cache,
Cake\Utility\Hash,
Cake\Utility\Inflector;
if (function_exists('mb_internal_encoding')) {
$encoding = Configure::read('App.encoding');
@@ -304,13 +304,13 @@ protected function _bindTextDomain($domain) {
$core = true;
$merge = array();
$searchPaths = App::path('locales');
$plugins = CakePlugin::loaded();
$plugins = Plugin::loaded();
if (!empty($plugins)) {
foreach ($plugins as $plugin) {
$pluginDomain = Inflector::underscore($plugin);
if ($pluginDomain === $domain) {
$searchPaths[] = CakePlugin::path($plugin) . 'Locale' . DS;
$searchPaths[] = Plugin::path($plugin) . 'Locale' . DS;
$searchPaths = array_reverse($searchPaths);
break;
}
@@ -16,7 +16,9 @@
* @since CakePHP(tm) v 1.2.0.4116
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
App::uses('CakeRequest', 'Network');
namespace Cake\I18n;
use Cake\Core\Configure,
Cake\Network\Request;
/**
* Localization
@@ -407,7 +409,7 @@ protected function _setLanguage($language = null) {
* @return boolean Success
*/
protected function _autoLanguage() {
$_detectableLanguages = CakeRequest::acceptLanguage();
$_detectableLanguages = Request::acceptLanguage();
foreach ($_detectableLanguages as $key => $langKey) {
if (isset($this->_l10nCatalog[$langKey])) {
$this->_setLanguage($langKey);
@@ -17,6 +17,8 @@
* @since CakePHP(tm) v 1.2.0.6833
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
namespace {
use Cake\I18n\Multibyte;
if (!function_exists('mb_stripos')) {
@@ -273,6 +275,12 @@ function mb_encode_mimeheader($str, $charset = 'UTF-8', $transferEncoding = 'B',
}
}
namespace Cake\I18n {
use Cake\Configure\PhpReader,
Cake\Core\Configure;
/**
* Multibyte handling methods.
*
@@ -395,9 +403,7 @@ public static function stripos($haystack, $needle, $offset = 0) {
* @return integer|boolean The portion of $haystack, or false if $needle is not found.
*/
public static function stristr($haystack, $needle, $part = false) {
$php = (PHP_VERSION < 5.3);
if (($php && $part) || Multibyte::checkMultibyte($haystack)) {
if (Multibyte::checkMultibyte($haystack)) {
$check = Multibyte::strtoupper($haystack);
$check = Multibyte::utf8($check);
$found = false;
@@ -438,10 +444,7 @@ public static function stristr($haystack, $needle, $part = false) {
return false;
}
if (!$php) {
return stristr($haystack, $needle, $part);
}
return stristr($haystack, $needle);
return stristr($haystack, $needle, $part);
}
/**
@@ -735,9 +738,7 @@ public static function strrpos($haystack, $needle, $offset = 0) {
* @return string|boolean The portion of $haystack, or true if $needle is not found.
*/
public static function strstr($haystack, $needle, $part = false) {
$php = (PHP_VERSION < 5.3);
if (($php && $part) || Multibyte::checkMultibyte($haystack)) {
if (Multibyte::checkMultibyte($haystack)) {
$check = Multibyte::utf8($haystack);
$found = false;
@@ -776,10 +777,7 @@ public static function strstr($haystack, $needle, $part = false) {
return false;
}
if (!$php) {
return strstr($haystack, $needle, $part);
}
return strstr($haystack, $needle);
return strstr($haystack, $needle, $part);
}
/**
@@ -1090,7 +1088,6 @@ protected static function _find($char, $type = 'lower') {
return null;
}
if (!Configure::configured('_cake_core_')) {
App::uses('PhpReader', 'Configure');
Configure::config('_cake_core_', new PhpReader(CAKE . 'Config' . DS));
}
Configure::load('unicode' . DS . 'casefolding' . DS . $range, '_cake_core_');
@@ -1132,3 +1129,5 @@ public static function checkMultibyte($string) {
}
}
}

0 comments on commit 206aca5

Please sign in to comment.
You can’t perform that action at this time.