Merge pull request #1590 from Phally/master-lctime

Avoid notices when loading locale file
This commit is contained in:
José Lorenzo Rodríguez 2013-08-31 21:49:00 -07:00
commit 87908a2bfa
3 changed files with 185 additions and 4 deletions

View file

@ -549,11 +549,11 @@ class I18n {
continue; continue;
} }
$count = count($parts); $count = count($parts);
if ($count == 2) { if ($count === 2) {
$currentToken = $parts[0]; $currentToken = $parts[0];
$value = $parts[1]; $value = $parts[1];
} elseif ($count == 1) { } elseif ($count === 1) {
$value .= $parts[0]; $value = is_array($value) ? $parts[0] : $value . $parts[0];
} else { } else {
continue; continue;
} }
@ -575,7 +575,7 @@ class I18n {
$val = str_replace($replacements, $mustEscape, $val); $val = str_replace($replacements, $mustEscape, $val);
$value[$i] = $val; $value[$i] = $val;
} }
if (count($value) == 1) { if (count($value) === 1) {
$definitions[$currentToken] = array_pop($value); $definitions[$currentToken] = array_pop($value);
} else { } else {
$definitions[$currentToken] = $value; $definitions[$currentToken] = $value;

View file

@ -1864,6 +1864,18 @@ class I18nTest extends CakeTestCase {
I18n::translate('Plural Rule 1', null, ''); I18n::translate('Plural Rule 1', null, '');
} }
/**
* testLoadLocaleDefinition method
*
* @return void
*/
public function testLoadLocaleDefinition() {
$path = current(App::path('locales'));
$result = I18n::loadLocaleDefinition($path . 'nld' . DS . 'LC_TIME');
$expected = array('zondag', 'maandag', 'dinsdag', 'woensdag', 'donderdag', 'vrijdag', 'zaterdag');
$this->assertSame($expected, $result['day']);
}
/** /**
* Singular method * Singular method
* *

View file

@ -0,0 +1,169 @@
comment_char %
escape_char /
%
% Dutch Language Locale for the Netherlands
% Source: RAP
% Address: Sankt Jo//rgens Alle 8
% DK-1615 Ko//benhavn V, Danmark
% Contact: Keld Simonsen
% Email: Keld.Simonsen@dkuug.dk
% Tel: +45 - 31226543
% Fax: +45 - 31205521
% Language: nl
% Territory: NL
% Revision: 4.3
% Date: 1996-10-15
% Users: general
% Charset: ISO-8859-1
% Distribution and use is free, also
% for commercial purposes.
LC_IDENTIFICATION
title "Dutch locale for the Netherlands"
source "RAP"
address "Sankt J<U00F8>rgens Alle 8, DK-1615 K<U00F8>benhavn V, Danmark"
contact ""
email "bug-glibc-locales@gnu.org"
tel ""
fax ""
language "Dutch"
territory "Netherlands"
revision "1.0"
date "2000-06-29"
%
category "nl_NL:2000";LC_IDENTIFICATION
category "nl_NL:2000";LC_CTYPE
category "nl_NL:2000";LC_COLLATE
category "nl_NL:2000";LC_TIME
category "nl_NL:2000";LC_NUMERIC
category "nl_NL:2000";LC_MONETARY
category "nl_NL:2000";LC_MESSAGES
category "nl_NL:2000";LC_PAPER
category "nl_NL:2000";LC_NAME
category "nl_NL:2000";LC_ADDRESS
category "nl_NL:2000";LC_TELEPHONE
END LC_IDENTIFICATION
LC_CTYPE
copy "i18n"
translit_start
include "translit_combining";""
translit_end
END LC_CTYPE
LC_COLLATE
copy "iso14651_t1"
END LC_COLLATE
LC_MESSAGES
yesexpr "<U005E><U005B><U006A><U004A><U0079><U0059><U005D><U002E><U002A>"
noexpr "<U005E><U005B><U006E><U004E><U005D><U002E><U002A>"
END LC_MESSAGES
LC_MONETARY
int_curr_symbol "<U0045><U0055><U0052><U0020>"
currency_symbol "<U20AC>"
mon_decimal_point "<U002C>"
mon_thousands_sep "<U0020>"
mon_grouping 3;3
positive_sign ""
negative_sign "<U002D>"
int_frac_digits 2
frac_digits 2
p_cs_precedes 1
p_sep_by_space 1
n_cs_precedes 1
n_sep_by_space 1
p_sign_posn 1
n_sign_posn 2
END LC_MONETARY
LC_NUMERIC
decimal_point "<U002C>"
thousands_sep ""
grouping 0;0
END LC_NUMERIC
LC_TIME
abday "<U007A><U006F>";"<U006D><U0061>";"<U0064><U0069>";/
"<U0077><U006F>";"<U0064><U006F>";"<U0076><U0072>";/
"<U007A><U0061>"
day "<U007A><U006F><U006E><U0064><U0061><U0067>";/
"<U006D><U0061><U0061><U006E><U0064><U0061><U0067>";/
"<U0064><U0069><U006E><U0073><U0064><U0061><U0067>";/
"<U0077><U006F><U0065><U006E><U0073><U0064><U0061><U0067>";/
"<U0064><U006F><U006E><U0064><U0065><U0072><U0064><U0061><U0067>";/
"<U0076><U0072><U0069><U006A><U0064><U0061><U0067>";/
"<U007A><U0061><U0074><U0065><U0072><U0064><U0061><U0067>"
abmon "<U006A><U0061><U006E>";"<U0066><U0065><U0062>";/
"<U006D><U0072><U0074>";"<U0061><U0070><U0072>";/
"<U006D><U0065><U0069>";"<U006A><U0075><U006E>";/
"<U006A><U0075><U006C>";"<U0061><U0075><U0067>";/
"<U0073><U0065><U0070>";"<U006F><U006B><U0074>";/
"<U006E><U006F><U0076>";"<U0064><U0065><U0063>"
mon "<U006A><U0061><U006E><U0075><U0061><U0072><U0069>";/
"<U0066><U0065><U0062><U0072><U0075><U0061><U0072><U0069>";/
"<U006D><U0061><U0061><U0072><U0074>";/
"<U0061><U0070><U0072><U0069><U006C>";/
"<U006D><U0065><U0069>";/
"<U006A><U0075><U006E><U0069>";/
"<U006A><U0075><U006C><U0069>";/
"<U0061><U0075><U0067><U0075><U0073><U0074><U0075><U0073>";/
"<U0073><U0065><U0070><U0074><U0065><U006D><U0062><U0065><U0072>";/
"<U006F><U006B><U0074><U006F><U0062><U0065><U0072>";/
"<U006E><U006F><U0076><U0065><U006D><U0062><U0065><U0072>";/
"<U0064><U0065><U0063><U0065><U006D><U0062><U0065><U0072>"
d_t_fmt "<U0025><U0061><U0020><U0025><U0064><U0020><U0025><U0062><U0020><U0025><U0059><U0020><U0025><U0054><U0020><U0025><U005A>"
d_fmt "<U0025><U0064><U002D><U0025><U006D><U002D><U0025><U0079>"
t_fmt "<U0025><U0054>"
am_pm "";""
t_fmt_ampm ""
date_fmt "<U0025><U0061><U0020><U0025><U0062><U0020><U0025><U0065>/
<U0020><U0025><U0048><U003A><U0025><U004D><U003A><U0025><U0053><U0020>/
<U0025><U005A><U0020><U0025><U0059>"
week 7;19971130;4
first_weekday 2
first_workday 2
END LC_TIME
LC_PAPER
% FIXME
height 297
% FIXME
width 210
END LC_PAPER
LC_TELEPHONE
tel_int_fmt "<U002B><U0025><U0063><U0020><U0025><U0061><U0020><U0025>/
<U006C>"
int_prefix "<U0033><U0031>"
END LC_TELEPHONE
LC_MEASUREMENT
% FIXME
measurement 1
END LC_MEASUREMENT
LC_NAME
name_fmt "<U0025><U0064><U0025><U0074><U0025><U0067><U0025><U0074>/
<U0025><U006D><U0025><U0074><U0025><U0066>"
END LC_NAME
LC_ADDRESS
postal_fmt "<U0025><U0066><U0025><U004E><U0025><U0061><U0025><U004E>/
<U0025><U0064><U0025><U004E><U0025><U0062><U0025><U004E><U0025><U0073>/
<U0020><U0025><U0068><U0020><U0025><U0065><U0020><U0025><U0072><U0025>/
<U004E><U0025><U007A><U0020><U0025><U0054><U0025>/
<U004E><U0025><U0063><U0025><U004E>"
country_ab2 "<U004E><U004C>"
country_ab3 "<U004E><U004C><U0044>"
country_num 528
country_car "<U004E><U004C>"
lang_name "<U0064><U0075><U0074><U0063><U0068>"
lang_ab "<U006E><U006C>"
lang_term "<U006E><U006C><U0064>"
lang_lib "<U0064><U0075><U0074>"
END LC_ADDRESS