Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding louder more informative error to i18n.

When a plural form is wrong, or the Plural-Forms header is wrong, we should
give a more useful error message than strlen() does.  Also make a dumb guess
at what the correct translation is.

Fixes #2045
  • Loading branch information...
commit bbad5d86bce51ba9c854319e1de9e7cb970ba2f4 1 parent a68cb4f
@markstory markstory authored
Showing with 12 additions and 0 deletions.
  1. +12 −0 lib/Cake/I18n/I18n.php
View
12 lib/Cake/I18n/I18n.php
@@ -185,6 +185,18 @@ public static function translate($singular, $plural = null, $domain = null, $cat
if (is_array($trans)) {
if (isset($trans[$plurals])) {
$trans = $trans[$plurals];
+ } else {
+ trigger_error(
+ __d('cake_dev',
+ 'Missing plural form translation for "%s" in "%s" domain, "%s" locale. ' .
+ ' Check your po file for correct plurals and valid Plural-Forms header.',
+ $singular,
+ $domain,
+ $_this->_lang
+ ),
+ E_USER_WARNING
+ );
+ $trans = $trans[0];
}
}
if (strlen($trans)) {
Please sign in to comment.
Something went wrong with that request. Please try again.