Skip to content

Commit

Permalink
fix multibyte test case
Browse files Browse the repository at this point in the history
put the mb_internal_encoding call in a file which is _always_ loaded
  • Loading branch information
AD7six committed May 17, 2011
1 parent d3772fc commit 83e7028
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
13 changes: 10 additions & 3 deletions lib/Cake/I18n/I18n.php
Expand Up @@ -24,6 +24,13 @@
App::uses('L10n', 'I18n');
App::uses('Multibyte', 'I18n');

if (function_exists('mb_internal_encoding')) {
$encoding = Configure::read('App.encoding');
if (!empty($encoding)) {
mb_internal_encoding($encoding);
}
}

/**
* I18n handles translation of Text and time format strings.
*
Expand Down Expand Up @@ -111,7 +118,7 @@ public static function &getInstance() {
*/
public static function translate($singular, $plural = null, $domain = null, $category = 6, $count = null) {
$_this = I18n::getInstance();

if (strpos($singular, "\r\n") !== false) {
$singular = str_replace("\r\n", "\n", $singular);
}
Expand Down Expand Up @@ -320,10 +327,10 @@ private function __bindTextDomain($domain) {
$this->__domains[$domain][$this->__lang][$this->category] = array();
return $domain;
}

if (isset($this->__domains[$domain][$this->__lang][$this->category][""])) {
$head = $this->__domains[$domain][$this->__lang][$this->category][""];

foreach (explode("\n", $head) as $line) {
$header = strtok($line,":");
$line = trim(strtok("\n"));
Expand Down
6 changes: 0 additions & 6 deletions lib/Cake/I18n/Multibyte.php
Expand Up @@ -17,12 +17,6 @@
* @since CakePHP(tm) v 1.2.0.6833
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
if (function_exists('mb_internal_encoding')) {
$encoding = Configure::read('App.encoding');
if (!empty($encoding)) {
mb_internal_encoding($encoding);
}
}

/**
* Find position of first occurrence of a case-insensitive string.
Expand Down

0 comments on commit 83e7028

Please sign in to comment.