LC_TIME support multi-byte value.

This commit is contained in:
hiromi2424 2010-03-03 11:42:53 +09:00 committed by José Lorenzo Rodríguez
parent ee3c2efec7
commit 256ce41b1f
3 changed files with 68 additions and 0 deletions

View file

@ -540,6 +540,9 @@ class I18n extends Object {
$delimiter = 'U00'; $delimiter = 'U00';
return join('', array_map('chr', array_map('hexdec', array_filter(explode($delimiter, $string))))); return join('', array_map('chr', array_map('hexdec', array_filter(explode($delimiter, $string)))));
} }
if (preg_match('/U([0-9a-fA-F]{4})/',$string,$match)){
return Multibyte::ascii(array(hexdec($match[1])));
}
return $string; return $string;
} }

View file

@ -2604,6 +2604,23 @@ class I18nTest extends CakeTestCase {
$this->assertEqual($result, $expected); $this->assertEqual($result, $expected);
} }
function testTimeDefinitionJapanese(){
Configure::write('Config.language', 'ja_jp');
$result = __c('d_fmt', 5, true);
$expected = "%Y年%m月%d日";
$this->assertEqual($result, $expected);
$result = __c('am_pm', 5, true);
$expected = array("午前", "午後");
$this->assertEqual($result, $expected);
$result = __c('abmon', 5, true);
$expected = array(" 1月", " 2月", " 3月", " 4月", " 5月", " 6月", " 7月", " 8月", " 9月", "10月", "11月", "12月");
$this->assertEqual($result, $expected);
}
/** /**
* Singular method * Singular method
* *

View file

@ -0,0 +1,48 @@
escape_char /
comment_char %
abday "<U65E5>";"<U6708>";"<U706B>";"<U6C34>";"<U6728>";"<U91D1>";"<U571F>"
day "<U65E5><U66DC><U65E5>";"<U6708><U66DC><U65E5>";/
"<U706B><U66DC><U65E5>";"<U6C34><U66DC><U65E5>";/
"<U6728><U66DC><U65E5>";"<U91D1><U66DC><U65E5>";/
"<U571F><U66DC><U65E5>"
week 7;19971130;7
first_weekday 1
first_workday 2
abmon "<U0020><U0031><U6708>";"<U0020><U0032><U6708>";/
"<U0020><U0033><U6708>";"<U0020><U0034><U6708>";/
"<U0020><U0035><U6708>";"<U0020><U0036><U6708>";/
"<U0020><U0037><U6708>";"<U0020><U0038><U6708>";/
"<U0020><U0039><U6708>";"<U0031><U0030><U6708>";/
"<U0031><U0031><U6708>";"<U0031><U0032><U6708>"
mon "<U0031><U6708>";"<U0032><U6708>";/
"<U0033><U6708>";"<U0034><U6708>";/
"<U0035><U6708>";"<U0036><U6708>";/
"<U0037><U6708>";"<U0038><U6708>";/
"<U0039><U6708>";"<U0031><U0030><U6708>";/
"<U0031><U0031><U6708>";"<U0031><U0032><U6708>"
% Appropriate date and time representation (%c)
%
d_t_fmt "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5><U0020><U0025><U0048><U6642><U0025><U004D><U5206><U0025><U0053><U79D2>"
%
% Appropriate date representation (%x)
% "%Y年%m月%d日"
d_fmt "<U0025><U0059><U5E74><U0025><U006D><U6708><U0025><U0064><U65E5>"
%
% Appropriate time representation (%X)
%
t_fmt "<U0025><U0048><U6642><U0025><U004D><U5206><U0025><U0053><U79D2>"
%
% Appropriate AM/PM time representation (%r)
%
t_fmt_ampm "<U0025><U0070><U0025><U0049><U6642><U0025><U004D><U5206><U0025><U0053><U79D2>"
%
% Strings for AM/PM
%
am_pm "<U5348><U524D>";"<U5348><U5F8C>"
%
% Appropriate date representation (date(1))
date_fmt "<U0025><U0059><U5E74><U0020><U0025><U0062><U0020><U0025>/
<U0065><U65E5><U0020><U0025><U0041><U0020><U0025><U0048><U003A><U0025>/
<U004D><U003A><U0025><U0053><U0020><U0025><U005A>"