mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 11:06:15 +00:00
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
This commit is contained in:
parent
a68cb4f9ce
commit
bbad5d86bc
1 changed files with 12 additions and 0 deletions
|
@ -185,6 +185,18 @@ class I18n {
|
||||||
if (is_array($trans)) {
|
if (is_array($trans)) {
|
||||||
if (isset($trans[$plurals])) {
|
if (isset($trans[$plurals])) {
|
||||||
$trans = $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)) {
|
if (strlen($trans)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue