Hi,
wondering if nobody else has this problem. Run Drupal 8.3.3, but had this problem in previous versions too.
I create a node type "news"
Add a date - field
Set type to multilingual (de, en)
Create various news nodes with different dates
Create translations for all news nodes
Add a new views -> type "news"
Filter Criteria -> Translation Language
Sort Criteria -> Our date field
If you check the sorting of the translation language, its very wild and make no sense at all. You can replace the date field with a number field, the sorting didnt work here too?!
Any Ideas?
Best, Alex
Comments
Comment #2
Alex_schwarz commentedOkay if date field ist set to translatable sorting works... but why should it be necessary to translate the field? A news date doesn't change just because of the translation language. Could be optimized.
Comment #3
Alex_schwarz commentedComment #4
mustanggb commentedComment #7
dbgilbert commentedCan confirm the exact same problem. Have a view filtering by language with a (non-translatable) date field as the only sort parameter. Results in inconsistent (random?) sorting for the translated content. Problem goes away if the date field is translatable but obviously that's not a desirable solution in many cases.
Comment #8
dbgilbert commentedThe sorting issue goes away if the Rendering Language of the view is set to "Interface text language selected for page" rather than "Content Language of View Row". This then introduces duplicate results (which I believe already has its own issue?), but enabling "Distinct" in the query options resolves that. Not a solution to the underlying issue, but perhaps evidence for what causes problem and a possible way to sidestep it.
Comment #9
julienjoye commented@dbgilbert Actually yes, it does sort the contents the right way with you trick. But untranslated contents are shown, (in their source language), which is not suitable for many cases. As soon as you FILTER the contents on language with the active language (to get only those who are translated), the sorting criteria is missing something, and the results are randomly sorted. I definitely confirm the issue.
Ok Note :
I use @dbgilbert trick, with this custom code that excludes non translated contents :
Comment #16
quietone commented@Alex_schwarz, Thank you for reporting this problem. We rely on issue reports like this to improve Drupal core.
I tested this on 9.4.x, standard install and was not able to reproduce this error. I followed the steps given in the Issue Summary although the second language was Italian. The nodes I created had different dates in each language. I filterer on no language, Italian and English, and in all cases the view was filtered correctly and in the correct date order.
If you are experiencing this problem on a supported version of Drupal reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core").
Thanks!