Multilingual Site: Module title not translated in learning path landing page.

Created on 24 November 2022, about 2 years ago
Updated 10 April 2024, 8 months ago

Problem/Motivation

For Multilingual site, once learning path and opigno_module content is translated. Module title is not getting translated in training landing page table.

Steps to reproduce

1. Create learning path training with Module in primary language. for example in english.
2. Translate both Module and training content.
3. Access the training in primary language, will see module title in English which is expected.
4. Then access same training in secondary language then also module title will be shown in English which is not getting translated.

🐛 Bug report
Status

Fixed

Version

3.0

Component

Code

Created by

🇮🇳India keerthana13

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.

  • 🇨🇭Switzerland axelm

    Hi
    Thanks for reporting this issue.
    The fix will be included to the next release of Opigno.

  • Status changed to Downport almost 2 years ago
  • 🇨🇭Switzerland axelm

    Released in Opigno 3.1.0

  • Status changed to Fixed over 1 year ago
  • Status changed to Fixed over 1 year ago
  • 🇨🇦Canada 2gendevs

    I don't think this has been fixed, or a new bug with the same issue has been introduced.

    In the latest version, 3.1.0 (and 3.1.1), the patched file no longer has the relevant code and instead it has been moved to the service LearningPathContentService.php.

    Within this file there is the block of code (starting around line 276):

            elseif ($step['typology'] === 'Module') {
              $module = OpignoModule::load($step['id']);
              $langcode = $this->languageManager->getCurrentLanguage()->getId();
              $step['module'] = $module->hasTranslation($langcode) ? $module->getTranslation($langcode) : $module;
              $step['name'] = $module->label();
            }
    
            $title = $step['name'];
    
    

    The call to $module->label(); does not appear to account for the translated values. Instead it is loading the default language value. Commenting out $module->label(); fixes the issue.

Production build 0.71.5 2024