Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add better formatting for multilingual titles #1164

Merged
merged 1 commit into from
May 24, 2023

Conversation

EerikSaksi
Copy link
Contributor

Fixes #1116

Description

What?

This pull request only shows the English title for modules and exercises, or the default language if the English translation does not exist. This preserves existing behavior for exercises and modules with no translations.

Why?
The titles were hard to read as it had messy formatting, and showed multiple languages.

How?

By using the parse_localization function on the title field, check if there are multiple translations of the title. If so, try to choose the English translation. If there is no English, default to whatever the first language is. If there is no translations, then just return the title as is.

Fixes #1116

Testing

Remember to add or update unit tests for new features and changes.

What type of test did you run?

  • Accessibility test using the WAVE extension.
  • Django unit tests.
  • Selenium tests.
  • Other test. (Add a description below)
  • Manual testing.

I used the O1 course to test multilingual titles, and the default aplus-manual courses for non-multilingual. I ensured that the English titles were chosen correctly for O1, and that behavior did not change at all in aplus-manual.

Did you test the changes in

  • Chrome
  • Firefox
  • This pull request cannot be tested in the browser.

Think of what is affected by these changes and could become broken

Translation

Programming style

  • Did you follow our style guides?
  • Did you use Python type hinting in all functions that you added or edited? (type hints for function parameters and return values)

Have you updated the README or other relevant documentation?

  • documents inside the doc directory.
  • README.md.
  • Aplus Manual.
  • Other documentation (mention below which documentation).

Is it Done?

  • Reviewer has finished the code review
  • After the review, the developer has made changes accordingly
  • Customer/Teacher has accepted the implementation of the feature

Clean up your git commit history before submitting the pull request!

Copy link
Contributor

@PasiSa PasiSa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me (just reading code, not testing). I assume this is tested with Moodle and some multilingual material that has applied the '|' notation. It seems that parse_localized() has not been used anywhere earlier apart from one manage script, but apparently it has been tested working.

@ihalaij1 ihalaij1 self-requested a review April 12, 2023 13:07
Copy link
Contributor

@ihalaij1 ihalaij1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good! Usually the comments have used capitalized first letters, but I'm not sure how much we care about that...

@markkuriekkinen markkuriekkinen self-assigned this Apr 12, 2023
Copy link
Contributor

@markkuriekkinen markkuriekkinen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not fix the (Moodle) gradebook grade item titles at all yet. The code only affects the Moodle activity names shown in the course section pages. The same view classes and methods that you have modified include the grade item creation too. In the Grades section of Moodle, you can still clearly see the titles in the raw multilingual format (which was part of the issue).

I think the code becomes simpler when you replace parse_localized() with pick_localized().

Rebase onto the upstream master branch and fix the git conflicts.

Include all cases of the LTI content selection (Deep Linking. Currently, you have not touched the class LtiSelectCourseView which corresponds to selecting one whole course.
The teacher may select any one of the following:

  • whole course
  • whole module
  • one chapter (with or without embedded assignments)
  • one assignment

lti_tool/views.py Outdated Show resolved Hide resolved
lti_tool/views.py Outdated Show resolved Hide resolved
Copy link
Contributor

@markkuriekkinen markkuriekkinen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this looks good now! I will test this a little and merge the PR tomorrow.

@markkuriekkinen markkuriekkinen merged commit ddd4b66 into apluslms:master May 24, 2023
@markkuriekkinen
Copy link
Contributor

I made a small change to the git commit message, hence the force push before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
4 participants