Problem/Motivation

When editing a course in a non-default language, the LMS Reference Field Widget always displays the lesson or activity in the default language, rather than the site's current language.

Steps to reproduce

Enable translations for courses, lessons, and activities.
Translate a course into a non-default language.
Edit the course as the non-default language.
When editing the lessons, the default language always appears no matter what language you're currently viewing the site.

Proposed resolution

Update the LMS Reference field to check if a translation exists for the item in the currently selected language. If so, use the translated version instead for the label and for the edit button.

If a translation does *not* exist for the currently selected language, replace the "edit" button with "translate" or "add translation".

Remaining tasks

Create patch.

User interface changes

When viewing an LMS reference field in the non-default language, translations are displayed instead for the original language of the content.

When no such translation exists, "Edit" becomes "Translate" or "Add Translation" and will add a translation for the item.

API changes

None.

Data model changes

Issue fork lms-3589941

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

socketwench created an issue.