Problem/Motivation
Many answer plugins rely on information entered into the associated Activity in order to configure their own display. For example, the Answer types with Feedback rely on the feedback fields on the Activity to display.
As the Answers are not rendering a whole entity, but rather individual field values, the Answers are thus responsible for managing which translation to display.
Steps to reproduce
Enable translation support on LMS entities.
Translate a course, lesson, and activity from the source language to the target language.
Login as a user with the target language set as a preference.
Enroll in the course.
Take the course, the answers will remain in the source language.
Proposed resolution
Modify the ActivityAnswerBase to inject the Language Manager.
Provide a translation helper to get translated field values from the Activity, if a translation exists.
Modify provided Answer types where necessary to use translated values.
Remaining tasks
Create patch.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork lms-3597839
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