diff --git a/lib/Cake/I18n/I18n.php b/lib/Cake/I18n/I18n.php index d3da164b749..b987c94c125 100644 --- a/lib/Cake/I18n/I18n.php +++ b/lib/Cake/I18n/I18n.php @@ -575,11 +575,15 @@ public static function loadLocaleDefinition($filename) { $val = str_replace($replacements, $mustEscape, $val); $value[$i] = $val; } + $value = array_filter($value); if (count($value) == 1) { $definitions[$currentToken] = array_pop($value); } else { $definitions[$currentToken] = $value; } + if (empty($value)) { + $value = ''; + } } return $definitions; diff --git a/lib/Cake/Test/Case/I18n/I18nTest.php b/lib/Cake/Test/Case/I18n/I18nTest.php index aae136cf5e7..67bc749e54a 100644 --- a/lib/Cake/Test/Case/I18n/I18nTest.php +++ b/lib/Cake/Test/Case/I18n/I18nTest.php @@ -1864,6 +1864,18 @@ public function testTranslateEmptyDomain() { 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 * diff --git a/lib/Cake/Test/test_app/Locale/nld/LC_TIME b/lib/Cake/Test/test_app/Locale/nld/LC_TIME new file mode 100644 index 00000000000..6f832927a33 --- /dev/null +++ b/lib/Cake/Test/test_app/Locale/nld/LC_TIME @@ -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 Jrgens Alle 8, DK-1615 Kbenhavn 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 "" +noexpr "" +END LC_MESSAGES + +LC_MONETARY +int_curr_symbol "" +currency_symbol "" +mon_decimal_point "" +mon_thousands_sep "" +mon_grouping 3;3 +positive_sign "" +negative_sign "" +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 "" +thousands_sep "" +grouping 0;0 +END LC_NUMERIC + +LC_TIME +abday "";"";"";/ + "";"";"";/ + "" +day "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "" +abmon "";"";/ + "";"";/ + "";"";/ + "";"";/ + "";"";/ + "";"" +mon "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "";/ + "" +d_t_fmt "" +d_fmt "" +t_fmt "" +am_pm "";"" +t_fmt_ampm "" +date_fmt "/ +/ +" + +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 "/ +" +int_prefix "" +END LC_TELEPHONE + +LC_MEASUREMENT +% FIXME +measurement 1 +END LC_MEASUREMENT + +LC_NAME +name_fmt "/ +" +END LC_NAME + +LC_ADDRESS +postal_fmt "/ +/ +/ +/ +" +country_ab2 "" +country_ab3 "" +country_num 528 +country_car "" +lang_name "" +lang_ab "" +lang_term "" +lang_lib "" +END LC_ADDRESS