-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
extension in the apache (intl) and i18n translations problem #11767
Comments
@samdark well the error is a mayus, plz can add in the documentation this... |
but the i18n is broken hehe Formatting message for language 'es' failed with error: Message pattern is invalid: msgfmt_create: message formatter creation failed: U_ARGUMENT_TYPE_MISMATCH. The message being formatted was: {notificationCount} {notificationCount, plural, =1{New} other{News}}. '{notificationCount} {notificationCount, plural, =1{New} other{News}}' => '{notificationCount} {notificationCount, plural, =1{New} other{News}}', public function format($message, $params, $language)
{
$params = (array) $params;
if ($params === []) {
return $message;
}
if (preg_match('~{\s*[\d\w]+\s*,~u', $message)) {
$formatter = $this->getMessageFormatter();
$result = $formatter->format($message, $params, $language);
if ($result === false) {
$errorMessage = $formatter->getErrorMessage();
Yii::warning("Formatting message for language '$language' failed with error: $errorMessage. The message being formatted was: $message.", __METHOD__);
return $message;
} else {
return $result;
}
}
$p = [];
foreach ($params as $name => $value) {
$p['{' . $name . '}'] = $value;
}
return strtr($message, $p);
} |
what is version intl ? |
try change |
@lynicidn nothing change and the version is our current ICU version is 54.1. |
ah, try use |
@lynicidn nothing :( but if i remove the extension intl work perfectly :S |
use |
work! |
but is rare if i have the {notificationCount} not work and when i remove this and add the # work ? |
👏 |
@samdark plz can add this in the documentations when use INTL ? |
So how the line looks in the end? |
@samdark строка содержащая 2 раза одну переменную не будет работать |
can you check |
@cebe's option works fine. The problem is out of Yii scope, closing |
This error occurs because of old ICU version on intl module on PHP. There is some scenarios that is hard to fix it, hosting providers for example, and a solution is to use the fallback function to format the message provided by Yii itself. Remove the if enclosing the fallbackformat call on MessageFormartter::formart . |
What steps will reproduce the problem?
install the extension in the apache (intl) and translate this (i18n)
What is the expected result?
the translate result
Additional info
Formatting message for language 'es' failed with error: Message pattern is invalid: msgfmt_create: message formatter creation failed: U_ARGUMENT_TYPE_MISMATCH. The message being formatted was: {notificationCount} {notificationCount, plural, =1{New} other{News}}.
i see this #1072
and i have passed in the requirements yii2 (is rare)
The text was updated successfully, but these errors were encountered: