Skip to content

refactor: replace injectIntl with useIntl #2290

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

anmolsah
Copy link

Description

This pull request replaces the deprecated injectIntl higher-order component with the modern useIntl hook from @edx/frontend-platform/i18n across multiple components.

This is part of the ongoing effort described in #2280 to modernize the internationalization approach across the codebase and improve compatibility with React functional components.

Files Refactored:

  • src/generic/SaveFormConnectionErrorAlert.jsx
  • src/editors/sharedComponents/CodeEditor/index.jsx
  • src/editors/containers/GameEditor/index.jsx
  • src/editors/containers/ProblemEditor/components/EditProblemView/SettingsWidget/settingsComponents/Randomization/index.jsx
  • src/generic/configure-modal/VisibilityTab.jsx
  • src/export-page/export-footer/ExportFooter.jsx
  • src/studio-home/tabs-section/courses-tab/contact-administrator/index.jsx
  • src/editors/containers/VideoEditor/components/VideoSettingsModal/components/SocialShareWidget/index.jsx
  • src/course-checklist/CourseChecklist.jsx
  • src/pages-and-resources/discussions/app-list/AppCard.jsx
  • src/files-and-videos/generic/UsageMetricsMessage.jsx
  • src/editors/containers/VideoEditor/components/VideoSettingsModal/components/DurationWidget/index.jsx
  • src/files-and-videos/generic/FileMenu.jsx
  • src/schedule-and-details/introducing-section/index.jsx

Impacted User Roles

  • Course Authors: These changes affect authoring UI components such as file actions, content overview editors, and media settings panels.

There are no user-facing UI or design changes—only internal refactoring to improve maintainability and remove deprecated patterns.

Supporting information

This change is part of:

Other information

  • This change is self-contained and does not rely on any other pending PRs.
  • No breaking changes, no migrations, and no Redux/API modifications involved.
  • No accessibility or UI design impact — this is a pure internal refactor.

Best Practices Checklist

We're trying to move away from some deprecated patterns in this codebase. Please
check if your PR meets these recommendations before asking for a review:

  • Any new files are using TypeScript (.ts, .tsx).
  • Deprecated propTypes, defaultProps, and injectIntl patterns are not used in any new or modified code.
  • Tests should use the helpers in src/testUtils.tsx (specifically initializeMocks)
  • Do not add new fields to the Redux state/store. Use React Context to share state among multiple components.
  • Use React Query to load data from REST APIs. See any apiHooks.ts in this repo for examples.
  • All new i18n messages in messages.ts files have a description for translators to use.
  • Imports avoid using ../. To import from parent folders, use @src, e.g. import { initializeMocks } from '@src/testUtils'; instead of from '../../../../testUtils'

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Jul 16, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Jul 16, 2025

Thanks for the pull request, @anmolsah!

This repository is currently maintained by @bradenmacdonald.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.


Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@bradenmacdonald
Copy link
Contributor

@anmolsah We need a signed Contributor Agreement from you before we can review this. Thanks.

@anmolsah
Copy link
Author

I have signed the CLA. Please recheck.

@@ -98,7 +98,6 @@ const CourseChecklist = ({
CourseChecklist.propTypes = {
courseId: PropTypes.string.isRequired,
// injected
Copy link
Contributor

Choose a reason for hiding this comment

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

Dont forget to remove the // injected comment related to the intl prop, I see it in some of the modified files.

@jacobo-dominguez-wgu
Copy link
Contributor

Hi @anmolsah, thanks for this contribution. The checks are failing due to some linting and formatting issues, please take a look. You can use the npm run fix:lint to get more details.

@anmolsah
Copy link
Author

I'm currently facing issues while installing the project dependencies on my local Windows machine. Running npm ci throws permission errors, and attempting to run ESLint results in memory-related crashes and unknown read errors from some config files.

I would appreciate any guidance or suggestions on how to properly set up the project on Windows. Please let me know if there are any known steps or workarounds for this environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Status: Needs Triage
Development

Successfully merging this pull request may close these issues.

4 participants