User tests: Successful: Unsuccessful:
In Crowdin, we changed how the plural suffixes are processed to avoid clashing with the special feature in our Text::plural() method that is first checking with the actual count as suffix.
Eg with 12 items it first looks for a string with the suffix _12 and only if not found it looks for suffixes as specified in the active language pack.
See some explanation also here: #28763
Now this had created an unexpected issue: Since we always load the en-GB files as fallback, that means we always have the en-GB plural forms loaded as well and they don't get overwritten with the active language strings since those use different suffixes (string based, eg _ONE, _OTHER) now.
Since english happily only has two plural forms, we only get an issue with the singular suffix ("_1").
This PR changes the behavior so a single count (1) doesn't get added to the potential suffixes ("_1").
This is a small B/C in theory. But in practice I don't see a use case where someone would add a special string for "one item" that is different from the regular singular plural form.
There are languages like french which share the same form for zero and one item, but those are differentiated already since we often use a specific "_0" suffix ("No items ..." instead of "0 items"). So that absolutely still works.
Use a language pack from Crowdin (eg the Welsh one) and check if the singular form works as expected. A simple test can be done by looking at the status module
None
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
?
|
Still does not work for Welsh. I still get 1 Visitor not 1 Ymwelydd.
@Fedik The "feature" was introduced for 2.5.0 with this commit: d918bd9. Due to B/C I don't want to change it to much now.
For 4.0 I was thinking at renaming the suffix to something like "_AMOUNT_1" which should not clash anymore with regular plural suffixes.
As for the _0 case, that's a project decision if we show "No items" instead of "0 items".
For 4.0 I was thinking at renaming the suffix to something like "_AMOUNT_1" which should not clash anymore with regular plural suffixes.
Maybe in 4.0 can just drop it at all, and notify translators that if they want a specific case for 1 (or 0, or 137 or any :) ) they should adopt their getPluralSuffixes()
method, to something like:
if ($n == 1) return ['_AMOUNT_1'];
Maybe in 4.0 can just drop it at all, and notify translators that if they want a specific case
It's a feature for the end user, not translators. At least that is how I understand it.
Hard to say with only a single commit and no reference to an issue.
The issue if Joomla! have constant with BLABLA_0
or BLABLA_1
etc , and you want to translate it as default BLABLA
,
it become not possible, because Text::plural
add _0 (or _1 etc) as suffix, and because there exist a core constant it still will use BLABLA_0
or BLABLA_1
instead of default BLABLA
.
This actually another reason why _0 should not be used for different purpose than just showing number.
Okay, it just a thought, nothing related to current pull request.
Okay, it just a thought, nothing related to current pull request.
But a good one! I think for 4.0 we can change that behavior.
Rebased to trigger Drone again. No Code was changed.
I have tested this item
See my previous comment.
I see that the Welsh TT actually added a workaround (extra string MOD_STATUS_USERS_1="Ymwelydd") into his package.
So for testing purposes please use the unmodified package from Crowdin:
staging.zip
I have not tested this item.
With the previous language pack ot works as expected.
@Bakual @richard67 If this PR will be included in Joomla 3.9.19 then the Welsh language pack 3.9.19 will be as exported from Crowdin and should be released on the same day as Joomla version (I am the translation coordinator).
That's what I would have expected
Yep, if it works with the Crowdin-Welsh package I posted and also the non-Crowdin german and french package, then it should be fine.
The workaround-welsh package can be ignored as it is a package which deals with the bug we try to solve here.
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC
Merging here thanks.
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2020-05-23 22:26:00 |
Closed_By | ⇒ | zero-24 | |
Labels |
Added:
?
|
I seen related issue in local translation team, and it really crazy :)
I do not know all reasons behind current logic, but I think Joomla! should not add anything, it makes no sense to me. Better if
Text::plural
will use only whatgetPluralSuffixes()
return, if nothing returns then use default constant, without any addition.Side note:?
Also use of "_0" suffix for "Not found" message is incorrect, the language should show only translation, not try to explain what is going on. if there "0 items" it should show "0 items", if program want to tell that "Nothing found' there should be separated message for it.
Such hacking will not ends well