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

Fix language preferentiality for duplicate resources #12152

Merged
merged 3 commits into from May 13, 2024

Conversation

rtibbles
Copy link
Member

@rtibbles rtibbles commented May 9, 2024

Summary

  • Fixes historically incorrect language code for Chewa, we had previously set it as 'nyn' which is for a completely different language.
  • Adds a migration step to migrate device settings from 'nyn' to the actual language code 'ny'
  • Fixes previously unnoticed regression where the copies modal for duplicate resources would not work
  • Adds support for cross checking multiple language codes to see if the current UI language matches the content language

References

Fixes #11751

Reviewer guidance

  • Change the user interface to Chewa and ensure that it is still translated.
  • Run 0.16.1, select Chewa as the default language. Upgrade to the asset from this PR and ensure that it is properly still showing in Chewa by default.
  • Install the first topic of KA English and KA Fufulde.
  • Engage with one exercise in Fufulde, do not master it.
  • Go to the home page, confirm that it appears in the resume learning in English if the UI is in English, check that the '2 locations' is clickable and the modal works.
  • Change the UI language to Fufulde, confirm that the resume learning shows the resource in Fufulde now.

Import duplicate resources in the KA English channel. Search for them, confirm that the duplicate resource modal works there as well.


Testing checklist

  • Contributor has fully tested the PR manually
  • If there are any front-end changes, before/after screenshots are included
  • Critical user journeys are covered by Gherkin stories
  • Critical and brittle code paths are covered by unit tests

PR process

  • PR has the correct target branch and milestone
  • PR has 'needs review' or 'work-in-progress' label
  • If PR is ready for review, a reviewer has been added. (Don't use 'Assignees')
  • If this is an important user-facing change, PR or related issue has a 'changelog' label
  • If this includes an internal dependency change, a link to the diff is provided

Reviewer checklist

  • Automated test coverage is satisfactory
  • PR is fully functional
  • PR has been tested for accessibility regressions
  • External dependency files were updated if necessary (yarn and pip)
  • Documentation is updated
  • Contributor is in AUTHORS.md

🚀 This description was created by Ellipsis for commit 2d074f3

Summary:

This PR corrects the Chewa language code, adds necessary migrations, updates handling of duplicate resources, and enhances language matching logic.

Key points:

  • Corrects Chewa language code from nyn to ny.
  • Adds migration for updated language code in device settings.
  • Updates duplicate resource modal handling in various views.
  • Enhances language matching logic in getContentLangActive function.
  • Ensures UI consistency and functionality post-migration.

Generated with ❤️ by ellipsis.dev

@rtibbles rtibbles added the TODO: needs review Waiting for review label May 9, 2024
@rtibbles rtibbles added this to the Kolibri 0.16: Planned Patch 2 milestone May 9, 2024
@github-actions github-actions bot added DEV: backend Python, databases, networking, filesystem... APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: frontend SIZE: small labels May 9, 2024
@rtibbles
Copy link
Member Author

Hey @ellipsis, give me a code review

Copy link

ellipsis-dev bot commented May 10, 2024

OK! Reviewing this PR...


Responding to this comment by @rtibbles. For more information about Ellipsis, check the documentation.

Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 2d074f3 in 2 minutes and 44 seconds

More details
  • Looked at 280 lines of code in 32 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. kolibri/core/device/upgrade.py:24
  • Draft comment:
    The function set_device_settings is not imported correctly. Ensure to import it from kolibri.core.device.utils to avoid runtime errors.
  • Reason this comment was not posted:
    Confidence of 0% on close inspection, compared to threshold of 50%.
2. kolibri/plugins/learn/assets/src/views/CopiesModal.vue:7
  • Draft comment:
    The event emitted here should be @closeModal instead of @submit to match the event handler in the parent components.
    @closeModal="$emit('closeModal')"
  • Reason this comment was not posted:
    Confidence of 0% on close inspection, compared to threshold of 50%.

Workflow ID: wflow_snNni4PbI8mB3BbG


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

6 days left in your free trial, upgrade for $20/seat/month or contact us.

};

export const getContentLangActive = language => {
const langCode = languageIdToCode(currentLanguage);
Copy link

Choose a reason for hiding this comment

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

The variable currentLanguage is used but not defined in the scope of getContentLangActive. Ensure that currentLanguage is correctly defined or passed as a parameter to this function.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's defined in the module scope.

@radinamatic
Copy link
Member

No luck with seeing the Chewa UI after upgrading from 0.16.1 to asset from this PR. nyn locale is not found (which was the point, I believe), but neither is any trace of the Chewa language in the language switcher, and the default device language is returned to browser. If the locale is manually edited to ny, it returns 404.

no-ny.mp4

Tested on Ubuntu 20.04 with Firefox and Chrome.

@rtibbles
Copy link
Member Author

Thanks @radinamatic - I am pretty sure I have forgotten to update the language code in one place. I'll do a quick search for the whole codebase for nyn to double check!

@rtibbles
Copy link
Member Author

There were a couple of spots I had missed. Including the fact that Intl.js doesn't actually have a polyfill for Chewa locale data. Thankfully, I was able to generate one automatically from sources. I think it should all be working as intended now.

@radinamatic
Copy link
Member

After the upgrade from 0.16.1 using the newest asset in this PR, nyn locale that was previously set as default logically gives the 404 error, but going to the home page reloads the new ny locale, and the Chewa language is present in the language switcher modal.

yes-ny.mp4

All is also well after installing the first topic of KA English and KA Fufulde, exercises engaged and not mastered appear in the resume... section, and the '2 locations' link is clickable and the modal works in both locales.

Fulfulde English
babe locations-1
ff-cm en

Importing duplicate resources in the KA English channel also displays the 2 locations link and the duplicate resource modal works

locations

Copy link
Member

@radinamatic radinamatic left a comment

Choose a reason for hiding this comment

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

Manual QA passes, good to go! 👏🏽 💯 :shipit:

Copy link
Member

@marcellamaki marcellamaki left a comment

Choose a reason for hiding this comment

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

Code review looks good to me. I think the sorting situation with the matching language codes is the better option for handling a bit of odd perfect/acceptable matching, and the comments are helpful to make it more parseable for other use cases.

Remains to be seen if future Marcella agrees with me.

@marcellamaki marcellamaki merged commit 32e1e94 into learningequality:release-v0.16.x May 13, 2024
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APP: Learn Re: Learn App (content, quizzes, lessons, etc.) DEV: backend Python, databases, networking, filesystem... DEV: frontend DEV: tools Internal tooling for development SIZE: medium SIZE: small TODO: needs review Waiting for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants