Skip to content

Commit

Permalink
LC_TIME support multi-byte value.
Browse files Browse the repository at this point in the history
  • Loading branch information
hiromi2424 authored and lorenzo committed Mar 3, 2010
1 parent ee3c2ef commit 256ce41
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cake/libs/i18n.php
Expand Up @@ -540,6 +540,9 @@ function __parseLiteralValue($string) {
$delimiter = 'U00';
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;
}

Expand Down
17 changes: 17 additions & 0 deletions cake/tests/cases/libs/i18n.test.php
Expand Up @@ -2604,6 +2604,23 @@ function testTimeDefinition() {
$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
*
Expand Down
48 changes: 48 additions & 0 deletions cake/tests/test_app/locale/ja_jp/LC_TIME
@@ -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>"

0 comments on commit 256ce41

Please sign in to comment.