Date parts are not translatable in Datelist::validateDatelist()

Created on 19 January 2018, over 6 years ago
Updated 30 January 2023, over 1 year ago

Problem/Motivation

If a part of datelist is not filled, you see a translatable error with a description which parts are not filled.
However, the names of the parts are not translatable because they are pasted as simple string literal parameters:

// The $value might be either "year", "month" or "day".
$form_state->setError($element[$value], t('A value must be selected for %part.', ['%part' => $value]));

Proposed resolution

Wrap the $value variable with t() function.

Remaining tasks

None.

User interface changes

Fully translatable error messages for invalid datetime fields.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Needs work

Version

9.5

Component
DatetimeΒ  β†’

Last updated 1 minute ago

Created by

πŸ‡ΊπŸ‡¦Ukraine y.litovchenko

Live updates comments and jobs are added and updated live.
  • D8MI

    (Drupal 8 Multilingual Initiative) is the tag used by the multilingual initiative to mark core issues (and some contributed module issues). For versions other than Drupal 8, use the i18n (Internationalization) tag on issues which involve or affect multilingual / multinational support. That is preferred over Translation.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • The Needs Review Queue Bot β†’ tested this issue. It either no longer applies to Drupal core, or fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".

    Apart from a re-roll or rebase, this issue may need more work to address feedback in the issue or MR comments. To progress an issue, incorporate this feedback as part of the process of updating the issue. This helps other contributors to know what is outstanding.

    Consult the Drupal Contributor Guide β†’ to find step-by-step guides for working with issues.

Production build 0.71.5 2024