-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix inability to translate to languages which don't have plural forms #6827
Conversation
@malukenho You are right. Fixed it. |
Please add a unit test. |
I've added a test for this issue. Please check it. |
@hissy |
Can you create a new unit test please instead of adding to existing ones? That makes it much clearer what is actually tested. |
@@ -401,6 +401,8 @@ public function translatePlural( | |||
} | |||
|
|||
return ($number == 1 ? $singular : $plural); | |||
} elseif (is_string($translation)) { | |||
$translation = (array) $translation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, This (array) cast
can be into array($translation)
?, to be clear for fallback.
Thank you for your review. I've separated my test from
Should I change this? @DASPRiD |
@hissy Makes sense, yes. |
OK, fixed it. |
Fix inability to translate to languages which don't have plural forms
Merged to master for release with 2.4. |
Thanks! 😄 |
…ral-form-lang Fix inability to translate to languages which don't have plural forms
Some languages (e.g. Japanese, Chinese, etc.) does not have plural forms. With these languages,
getTranslatedMessage
function returns string value instead of array, even intranslatePlural
function. However,translatePlural
function can not treat a string value. This issue is critical for us.