Translate the relative date text

Created on 5 July 2024, about 1 year ago

Problem/Motivation

We want to be able to translate texts about relative dates, for example:
We add the relative date +1 year and as text is shown in the facet Next year, we want to be able to translate this Next year text in the different languages of the web portal.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.1

Component

User interface

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @alfaro
  • First commit to issue fork.
  • 🇨🇦Canada jinah2020

    I've experienced the same issue and created a patch to fix the translation support.

    The patch modifies RelativeDateItemProcessor.php to wrap all hardcoded strings with $this->t() function, making them translatable through Drupal's standard translation interface.

    Changes made:
    - Wrapped display value strings with $this->t()
    - Tested with Drupal 10.x in multilingual setup
    - Works with Facet 3 and facets_exposed_filters once the patch from Issues #3503718 🐛 Update to work with Facets 3.0 facets_exposed_filters Active is applied

Production build 0.71.5 2024