- Issue created by @Eugene Bocharov
- First commit to issue fork.
- Status changed to Needs review
5 months ago 2:04pm 22 June 2024 - Merge request !8490Resolve #3456417 "Datehelperdayofweekname returns untranslated" β (Open) created by Eugene Bocharov
Thank you @Pablo_Pukha, this is exactly what we need. I just added fix for test.
- Issue was unassigned.
- Status changed to Needs work
5 months ago 4:04pm 22 June 2024 - πΊπΈUnited States smustgrave
MR needs to be update to 11.x vs 11.0.x
11.x is the "main" development branch.
- Merge request !8493Resolve #3456417 "DateHelper::dayOfWeekName() returns untranslated name" β (Open) created by Eugene Bocharov
Eugene Bocharov β changed the visibility of the branch 3456417-datehelperdayofweekname-returns-untranslated to hidden.
- Status changed to Needs review
5 months ago 4:56pm 22 June 2024 - πΊπΈUnited States smustgrave
Problem is this could break existing sites that are using this function as it's changing what's returned so will have to think about that one.
Yes, but previous change might have broken sites that used original behavior of the method. Here we just return to original state. It is over the year since last change though. So I'm not sure what's the best solution at this point. There might be broken expectation either way.
- π«π·France andypost
I think it needs change record and detail the docs comment about return value
- π³πΏNew Zealand quietone
Fixes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies. Also, 10.2 is in security mode now.
- Status changed to Needs work
4 months ago 6:56pm 1 August 2024 - πΊπΈUnited States smustgrave
See a CR has been made but moving to NW for 2nd part of #13
- Status changed to Needs review
about 2 months ago 6:58am 2 October 2024 - π³πΏNew Zealand quietone
This does look like a regression, changing title. I updated the IS to point to the comment where the change was made in the originating issue.
The change here look correct but I don't like that there is not a test to prevent a regression in the future. Also, the test in the MR passes when \Drupal\Core\Datetime\DateHelper::dayOfWeekName has not been changed. So, I do think we should take the time to add a test so this does not happen in the future.
The change record states that this currently always returns the English but that will not be true for sites that install with a language other than English. Adding tag for CR update.
I went to update the 'remaining tasks' section but it is missing. Restoring that and updating it.
The change record states that this currently always returns the English but that will not be true for sites that install with a language other than English. Adding tag for CR update.
Hm, I can not see how it's possible.
Currently it returnsreturn $days[$dow]->getUntranslatedString();
But this returns TranslatableMarkup::$string, which is just string passed to the constructor. And both DateHelper::weekDays() and DateHelper::weekDaysAbbr() pass English strings to the t(). Please, correct me if I'm wrong.
- π³πΏNew Zealand quietone
Sorry, you are correct. I must have accidentally tested with the MR applied.
- π¬π§United Kingdom andrew.farquharson
What @quietone says in #18:
So, I do think we should take the time to add a test so this does not happen in the future.
That still sounds correct. Test changing the language eg from default 'en' to 'fr' and asserting that the day of the week in that language is returned. eg 'lundi'.
The concerns about regressions seem reasonable. But the rule is to create a test for the functionality being implemented whethere it is a new features, a reversion to old code. In terms of creating a failing test, those matters are immaterial. The test seems to me to be missing and should be added. It should fail before the MR is applied and pass after it is applied.
If such a test is in place already, then I have misunderstood.
I've added test just for returning value type, because, as for me, checking exact value returning from TranslatableMarkup looks more like test for translating system, which should be done (and obviously done) in another place.
- π¬π§United Kingdom andrew.farquharson
@eugene bocharov I had a look at possible places in core to create the test, looked inside the translation system. I could find no obvious place to put a test whether a unit or other type of test.
I've added test just for returning value type
That seems the right approach.
- π©πͺGermany luenemann SΓΌdbaden, Germany
Test only job fails as expected:
https://git.drupalcode.org/issue/drupal-3456417/-/jobs/3168817 - π΅π±Poland dmitry.korhov Poland, Warsaw
It seems that no more work is needed so we can go further