? ? Pending

User tests: Successful: Unsuccessful:

avatar Bakual
Bakual
10 May 2020

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").

Summary of Changes

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.

Testing Instructions

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

Expected result

image

Actual result

image

Documentation Changes Required

None

avatar Bakual Bakual - open - 10 May 2020
avatar Bakual Bakual - change - 10 May 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 10 May 2020
Category Libraries
avatar Bakual Bakual - change - 10 May 2020
Labels Added: ?
avatar Fedik
Fedik - comment - 11 May 2020

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 what getPluralSuffixes() 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 ?

avatar dyfrig
dyfrig - comment - 11 May 2020

Still does not work for Welsh. I still get 1 Visitor not 1 Ymwelydd.

avatar Bakual
Bakual - comment - 11 May 2020

@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".

avatar Fedik
Fedik - comment - 11 May 2020

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'];
avatar Bakual
Bakual - comment - 11 May 2020

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. ?

avatar Bakual
Bakual - comment - 11 May 2020

@dyfrig Can you test again? I used the wrong variable for the check. Now it works.

image

avatar Fedik
Fedik - comment - 11 May 2020

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.

avatar Bakual
Bakual - comment - 11 May 2020

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.

avatar dyfrig
dyfrig - comment - 11 May 2020

@Bakual - Tested with Welsh and it now works for all plurals including 1.

avatar Bakual
Bakual - comment - 12 May 2020

Rebased to trigger Drone again. No Code was changed.

avatar Quy Quy - alter_testresult - 14 May 2020 - dyfrig: Tested successfully
avatar richard67
richard67 - comment - 21 May 2020

@Bakual With current staging and current 3.9.18.1 Welsh language pack I get without this PR:
j3-pr-29029-welsh_before-patch
And with this PR I get:
j3-pr-29029-welsh
Maybe one of you last changes after @dyfrig had tested has broken it?
@dyfrig Could you test again? Thanks in advance.

avatar richard67 richard67 - test_item - 21 May 2020 - Tested unsuccessfully
avatar richard67
richard67 - comment - 21 May 2020

I have tested this item ? unsuccessfully on 8f2513b

See my previous comment.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29029.

avatar Bakual
Bakual - comment - 21 May 2020

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

avatar richard67 richard67 - test_item - 21 May 2020 - Not tested
avatar richard67
richard67 - comment - 21 May 2020

I have not tested this item.

With the previous language pack ot works as expected.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29029.

avatar richard67
richard67 - comment - 21 May 2020

@Bakual With the language pack which you have linked it works as expected. Bit since the new language pack with that workaround has been released, it needs the cms to handle this, too, or not?

avatar richard67
richard67 - comment - 21 May 2020

@Bakual Or does the Welsh language pack needs to be fixed? In this case, could you inform the translation coordinator?

avatar dyfrig
dyfrig - comment - 21 May 2020

@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).

avatar Bakual
Bakual - comment - 21 May 2020

That's what I would have expected ?

avatar richard67
richard67 - comment - 21 May 2020

@Bakual That means this PR is ok? I've tested also with French and German, it works well.

avatar Bakual
Bakual - comment - 21 May 2020

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.

avatar richard67 richard67 - test_item - 21 May 2020 - Tested successfully
avatar richard67
richard67 - comment - 21 May 2020

I have tested this item successfully on 8f2513b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29029.

avatar richard67 richard67 - change - 21 May 2020
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 21 May 2020

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/29029.

avatar zero-24
zero-24 - comment - 23 May 2020

Merging here thanks. ?

avatar zero-24 zero-24 - change - 23 May 2020
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: ?
avatar zero-24 zero-24 - close - 23 May 2020
avatar zero-24 zero-24 - merge - 23 May 2020

Add a Comment

Login with GitHub to post a comment