Default translation if no translation to the current language

Created on 31 March 2022, about 2 years ago
Updated 6 January 2024, 6 months ago

The classic always displays a default translation if there is no translation to the current language.
conditional_message.module

  // Send config info to JS.
  foreach ($configs as $cmid => $config) {
    // Get message in correct language (or do not display).
    if ($config->hasTranslation($current_langcode)) {
      $config = $config->getTranslation($current_langcode);
      $status = $config->isPublished();
    }
    else {
/*WT-patch Default translation*/
      //$status = FALSE;
      $config = $config->getTranslation( \Drupal::languageManager()->getDefaultLanguage()->getId() );
      $status = $config->isPublished();
/*<<<*/
    }
✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇮🇱Israel Promo-IL

Live updates comments and jobs are added and updated live.
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.

  • Until we have a condition to display only on some languages I'm going to keep the functionality as it is. I'll convert this to a feature request. Otherwise we wouldn't be able to hide the message in a language that does not have translations.

Production build 0.69.0 2024