Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The $date variable used in the node.tpl.php of wetkit_omega theme outputs the date of the node, and thus shows the same value for all languages, even if only one of them has been updated.
I'll provide a patch to the preprocess function in order to make it output the date of the translated object.
Comment | File | Size | Author |
---|---|---|---|
#5 | make-modified-date-reflect-translation-2344473-4.patch | 837 bytes | omar |
#1 | make-modified-date-reflect-translation-2344473-1.patch | 969 bytes | omar |
Comments
Comment #1
omar CreditAttribution: omar commentedHere's the patch.
Comment #2
sylus CreditAttribution: sylus commentedI think this is the wrong way to approach this. Since the date variable is being passed to format_date, you should be able to adjust the french view by going to the regional settings in Drupal and specifying an alternate date display for the french side. Of course this will only work for default cases and not exceptions like discussed here:
#2338993
I think this is a problem that core + i18n has solved if not correct please re-open but would like to address the regional settings solution first.
Comment #3
omar CreditAttribution: omar commentedI'm re-opening as I think that there may be a misunderstanding. The issue is not related to the *format* of the date, but rather *which* date is being displayed, the node's modification date, or the translation's modification date. i.e. the date/time that one language version was created/updated will be different than for other languages.
Comment #4
spotzero CreditAttribution: spotzero commentedThis patch makes assumptions about the specific translation configuration for all node types on the site, which are not enforced and therefore may not be correct.
This patch should check to verify that the translation changed time is available, and only use if its set, if not, it should fall back to the node changed time.
Something like this:
Comment #5
omar CreditAttribution: omar commentedThanks @spotzero ! This is good feedback and with code to boot... sweet!
I tested the code with a node that has translations and one without. It seems to work as expected. I rolled a patch with your code.
Comment #6
omar CreditAttribution: omar commentedComment #7
omar CreditAttribution: omar commentedComment #8
sylus CreditAttribution: sylus commentedCommitted and attributed! Thanks guys!