#6115: l10n ---------------------------+------------------------------------------------ Reporter: verbal | Owner: Type: Bug | Status: new Priority: Medium | Milestone: 1.2.x.x Component: i18n/l10n | Version: 1.2 Final Severity: Normal | Resolution: Keywords: | Php_version: PHP 5 Cake_version: 1.2.1.8004 | ---------------------------+------------------------------------------------ Old description:
> I got different results for: > > __n('hour', 'hours', 1); > > and > > __n('hour', 'hours', (float)1); > > In my .po files I use: > > msgid "%plural-c" > msgstr "nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || > n%100>=20) ? 1 : 2;" > > msgid "hour" > msgid_plural "hours" > msgstr[0] "godzina" > msgstr[1] "godziny" > msgstr[2] "godzin" > > With __n('hour', 'hours', 1) I get "godzina", with __n('hour', 'hours', > (float)1) I get "godzin". > > I found this problem using your TimeHelper::timeAgoInWords() function. > The problem lays in I18n::__pluralGuess where you compare with "===" > which compares also types as I recall and it will return false on > "(float)1 === 1". New description: I got different results for: {{{ __n('hour', 'hours', 1); and __n('hour', 'hours', (float)1); In my .po files I use: msgid "%plural-c" msgstr "nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;" msgid "hour" msgid_plural "hours" msgstr[0] "godzina" msgstr[1] "godziny" msgstr[2] "godzin" }}} With __n('hour', 'hours', 1) I get "godzina", with __n('hour', 'hours', (float)1) I get "godzin". I found this problem using your TimeHelper::timeAgoInWords() function. The problem lays in I18n::__pluralGuess where you compare with "===" which compares also types as I recall and it will return false on "(float)1 === 1". -- Ticket URL: <https://trac.cakephp.org/ticket/6115#comment:1> CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/> Cake is a rapid development framework for PHP which uses commonly known design patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. Our primary goal is to provide a structured framework that enables PHP users at all levels to rapidly develop robust web applications, without any loss to flexibility. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "tickets cakephp" group. To post to this group, send email to tickets-cakephp@googlegroups.com To unsubscribe from this group, send email to tickets-cakephp+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/tickets-cakephp?hl=en -~----------~----~----~----~------~----~------~--~---