Permalink
Browse files

fixes #6492, removing use of define LC_MESSAGES due to inconsistency …

…on different operating systems

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8223 3807eeeb-6ff5-0310-8944-8be069107fe0
  • Loading branch information...
1 parent bc5de16 commit 508f0651a4f1d958a2dac0599cb81af15cbef19f gwoo committed Jul 6, 2009
Showing with 17 additions and 24 deletions.
  1. +4 −11 cake/basics.php
  2. +1 −1 cake/libs/i18n.php
  3. +12 −12 cake/tests/cases/basics.test.php
View
@@ -35,13 +35,6 @@
define('MONTH', 30 * DAY);
define('YEAR', 365 * DAY);
/**
- * Add constant for LC_MESSAGES because it is not defined on windows
- */
- if (!defined('LC_MESSAGES')) {
- define('LC_MESSAGES', 6);
- }
-
-/**
* Patch for PHP < 5.0
*/
if (!function_exists('clone')) {
@@ -631,9 +624,9 @@ function __n($singular, $plural, $count, $return = false) {
}
if ($return === false) {
- echo I18n::translate($singular, $plural, null, LC_MESSAGES, $count);
+ echo I18n::translate($singular, $plural, null, 6, $count);
} else {
- return I18n::translate($singular, $plural, null, LC_MESSAGES, $count);
+ return I18n::translate($singular, $plural, null, 6, $count);
}
}
/**
@@ -679,9 +672,9 @@ function __dn($domain, $singular, $plural, $count, $return = false) {
}
if ($return === false) {
- echo I18n::translate($singular, $plural, $domain, LC_MESSAGES, $count);
+ echo I18n::translate($singular, $plural, $domain, 6, $count);
} else {
- return I18n::translate($singular, $plural, $domain, LC_MESSAGES, $count);
+ return I18n::translate($singular, $plural, $domain, 6, $count);
}
}
/**
View
@@ -123,7 +123,7 @@ function &getInstance() {
* @return string translated strings.
* @access public
*/
- function translate($singular, $plural = null, $domain = null, $category = LC_MESSAGES, $count = null) {
+ function translate($singular, $plural = null, $domain = null, $category = 6, $count = null) {
$_this =& I18n::getInstance();
if (strpos($singular, "\r\n") !== false) {
@@ -388,16 +388,16 @@ function test__dn() {
function test__c() {
Configure::write('Config.language', 'rule_1_po');
- $result = __c('Plural Rule 1', LC_MESSAGES, true);
+ $result = __c('Plural Rule 1', 6, true);
$expected = 'Plural Rule 1 (translated)';
$this->assertEqual($result, $expected);
- $result = __c('Plural Rule 1 (from core)', LC_MESSAGES, true);
+ $result = __c('Plural Rule 1 (from core)', 6, true);
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
ob_start();
- __c('Plural Rule 1 (from core)', LC_MESSAGES);
+ __c('Plural Rule 1 (from core)', 6);
$result = ob_get_clean();
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
@@ -411,24 +411,24 @@ function test__c() {
function test__dc() {
Configure::write('Config.language', 'rule_1_po');
- $result = __dc('default', 'Plural Rule 1', LC_MESSAGES, true);
+ $result = __dc('default', 'Plural Rule 1', 6, true);
$expected = 'Plural Rule 1 (translated)';
$this->assertEqual($result, $expected);
- $result = __dc('default', 'Plural Rule 1 (from core)', LC_MESSAGES, true);
+ $result = __dc('default', 'Plural Rule 1 (from core)', 6, true);
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
- $result = __dc('core', 'Plural Rule 1', LC_MESSAGES, true);
+ $result = __dc('core', 'Plural Rule 1', 6, true);
$expected = 'Plural Rule 1';
$this->assertEqual($result, $expected);
- $result = __dc('core', 'Plural Rule 1 (from core)', LC_MESSAGES, true);
+ $result = __dc('core', 'Plural Rule 1 (from core)', 6, true);
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
ob_start();
- __dc('default', 'Plural Rule 1 (from core)', LC_MESSAGES);
+ __dc('default', 'Plural Rule 1 (from core)', 6);
$result = ob_get_clean();
$expected = 'Plural Rule 1 (from core translated)';
$this->assertEqual($result, $expected);
@@ -442,20 +442,20 @@ function test__dc() {
function test__dcn() {
Configure::write('Config.language', 'rule_1_po');
- $result = __dcn('default', '%d = 1', '%d = 0 or > 1', 0, LC_MESSAGES, true);
+ $result = __dcn('default', '%d = 1', '%d = 0 or > 1', 0, 6, true);
$expected = '%d = 0 or > 1 (translated)';
$this->assertEqual($result, $expected);
- $result = __dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, LC_MESSAGES, true);
+ $result = __dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, 6, true);
$expected = '%d = 1 (from core translated)';
$this->assertEqual($result, $expected);
- $result = __dcn('core', '%d = 1', '%d = 0 or > 1', 0, LC_MESSAGES, true);
+ $result = __dcn('core', '%d = 1', '%d = 0 or > 1', 0, 6, true);
$expected = '%d = 0 or > 1';
$this->assertEqual($result, $expected);
ob_start();
- __dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, LC_MESSAGES);
+ __dcn('default', '%d = 1 (from core)', '%d = 0 or > 1 (from core)', 1, 6);
$result = ob_get_clean();
$expected = '%d = 1 (from core translated)';
$this->assertEqual($result, $expected);

0 comments on commit 508f065

Please sign in to comment.