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

feat: add experimental atlas to pull_translations #1093

Merged
merged 1 commit into from
May 9, 2023

Conversation

OmarIthawi
Copy link
Member

@OmarIthawi OmarIthawi commented Mar 30, 2023

Description

This is an experimental off-by-defualt feature for moving the translation files ouside the repos.

Run OPENEDX_ATLAS_PULL=true make translations to use atlas to pull translations instead of transifex.

Changes

Reviewers

Sample expected outcome

The file tree after running the new pull_translations will look like the following:

All messages will be pulled fresh, without depending on any messages from the MFE or its depedencies.

frontend-app-learning $ tree src/i18n/
src/i18n/
├── index.js
└── messages
    ├── frontend-app-learning
    │   ├── ar.json
    │   ├── de.json
    │   ├── es_419.json
    │   ├── fr_CA.json
    │   ├── index.js
    │   ├── ru.json
    │   ├── uk.json
    │   └── zh_CN.json
    ├── frontend-component-footer
    │   ├── ar.json
    │   ├── de_DE.json
    │   ├── de.json
    │   ├── es_419.json
    │   ├── fr_CA.json
    │   ├── fr.json
    │   ├── hi.json
    │   ├── it_IT.json
    │   ├── it.json
    │   ├── pt.json
    │   ├── pt_PT.json
    │   ├── ru.json
    │   ├── uk.json
    │   └── zh_CN.json
    └── frontend-component-header

Sample package index.js file

For each directory/package an index.js file will be generated if and only if there are messages in the files:

// This file is generated by the Open edX generate-mfe-i18n-imports.
// Refer to docs yada yada ...
//

import messages0ar from './ar.json';
import messages1de from './de.json';
import messages2es_419 from './es_419.json';
import messages3fr_CA from './fr_CA.json';
import messages4ru from './ru.json';
import messages5uk from './uk.json';
import messages6zh_CN from './zh_CN.json';
const messages = {
  'ar': messages0ar,
  'zh-cn': messages6zh_CN,
  'uk': messages5uk,
  'ru': messages4ru,
  'fr-ca': messages3fr_CA,
  'es-419': messages2es_419,
  'de': messages1de,
};
export default messages;

Sample MFE src/i18n/index.js file

A new index.js is going to be generated containing only downloaded languages.

// This file is generated by the Open edX frontend-platform's i18n-imports commands.
//

import messages1frontendcomponentheader from './messages/frontend-component-header';
// footer is omitted due to not having translations
import messages2frontendapplearning from './messages/frontend-app-learning';

export default [
  messages1frontendcomponentheader,
  messages2frontendapplearning,
];

References

This pull request is part of the FC-0012 project which is sparked by the Translation Infrastructure update OEP-58.

Check the links above for full information about the overall project.

Internalization is being rearchitected in Open edX Python, XBlock, Micro-frontend, and other projects. There are a number of immediately visible changes:

  • Remove source and language translations from the repositories, hence no .json, .po or .mo files will be committed into the repos.
  • Add standardized make extract_translations in all repositories
  • Push user-facing messages strings into openedx/openedx-translations.
  • Integrate root repositories with openedx/openedx-atlas to pull translations on build/deploy time

Breaking Changes

One of the primary goals of the project is to avoid breaking changes. If you noticed any suspicious code, please raise your concern. But before that, please know the strategy we're following to avoid breaking changes

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Mar 30, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Mar 30, 2023

Thanks for the pull request, @OmarIthawi! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@codecov
Copy link

codecov bot commented Mar 30, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (e0acb50) 87.03% compared to head (d147125) 87.03%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1093   +/-   ##
=======================================
  Coverage   87.03%   87.03%           
=======================================
  Files         253      253           
  Lines        4381     4381           
  Branches     1108     1108           
=======================================
  Hits         3813     3813           
  Misses        549      549           
  Partials       19       19           
Impacted Files Coverage Δ
src/index.jsx 0.00% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@OmarIthawi
Copy link
Member Author

Hi, @edx/engage-squad I'd love a quick sanity check before I invest more time in shaping up this work, remove temp. references and add documentation.

cc: @mphilbrick211, it turns out I can't tag the right team.

Copy link
Contributor

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

This is looking really great! Definitely a good pattern when combined with openedx/frontend-platform#463!

Just one little note as a reminder so we don't forget and merge this while pointing to the Zeit Labs fork, but other than that this is looking good to go!

Makefile Outdated Show resolved Hide resolved
@OmarIthawi OmarIthawi force-pushed the generate-i18n-modules branch 2 times, most recently from 5c00ba7 to f5b8924 Compare April 4, 2023 22:33
@mphilbrick211
Copy link

Hi, @edx/engage-squad I'd love a quick sanity check before I invest more time in shaping up this work, remove temp. references and add documentation.

cc: @mphilbrick211, it turns out I can't tag the right team.

@OmarIthawi sorry for the late reply. @openedx/engage-squad - could someone please take a look at this? Thanks!

@OmarIthawi OmarIthawi force-pushed the generate-i18n-modules branch 4 times, most recently from 589f071 to 468d396 Compare April 11, 2023 15:25
@itsjeyd itsjeyd added the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label Apr 13, 2023
@itsjeyd
Copy link

itsjeyd commented Apr 13, 2023

Hey @OmarIthawi, just checking in to see if @brian-smith-tcril's feedback addressed your need for a quick sanity check? Or are you still looking for additional input from the engage-squad before continuing?

@OmarIthawi
Copy link
Member Author

OmarIthawi commented Apr 13, 2023

Hey @OmarIthawi, just checking in to see if @brian-smith-tcril's feedback addressed your need for a quick sanity check? Or are you still looking for additional input from the engage-squad before continuing?

@itsjeyd I've got the initial review. Thanks for checking.

I'm now blocked by other PRs which brings the required intl-imports.js command:

@OmarIthawi OmarIthawi marked this pull request as ready for review April 13, 2023 12:06
@brian-smith-tcril
Copy link
Contributor

Hey @OmarIthawi, just checking in to see if @brian-smith-tcril's feedback addressed your need for a quick sanity check? Or are you still looking for additional input from the engage-squad before continuing?

@itsjeyd I've got the initial review. Thanks for checking.

I'm now blocked by other PRs which brings the required intl-imports.js command:

All the linked PRs are merged now!

@OmarIthawi
Copy link
Member Author

Thanks @brian-smith-tcril. We still need to tag new releases on both the header and footer on GitHub so they're published on npm.

@OmarIthawi OmarIthawi force-pushed the generate-i18n-modules branch 3 times, most recently from 13fbdfd to e252883 Compare April 18, 2023 16:15
@OmarIthawi OmarIthawi force-pushed the generate-i18n-modules branch 2 times, most recently from 9d0401c to 620d847 Compare April 19, 2023 16:21
@OmarIthawi OmarIthawi marked this pull request as draft April 20, 2023 13:28
@brian-smith-tcril
Copy link
Contributor

We still need to tag new releases on both the header and footer on GitHub so they're published on npm.

Releases are out for header and footer now!
https://github.com/openedx/frontend-component-header/releases/tag/v3.7.3
https://github.com/openedx/frontend-component-footer/releases/tag/v11.7.3

@OmarIthawi
Copy link
Member Author

OmarIthawi commented Apr 20, 2023

We still need to tag new releases on both the header and footer on GitHub so they're published on npm.

Releases are out for header and footer now! https://github.com/openedx/frontend-component-header/releases/tag/v3.7.3 https://github.com/openedx/frontend-component-footer/releases/tag/v11.7.3

Thanks! It turns out we have another blocker. I've updated the PR description: https://github.com/openedx/frontend-lib-special-exams is stuck on [email protected] and needs the following PR to be merged:

@brian-smith-tcril brian-smith-tcril added the blocked by other work PR cannot be finished until other work is complete label Apr 20, 2023
@OmarIthawi OmarIthawi force-pushed the generate-i18n-modules branch 3 times, most recently from 1403d97 to c0b8ca6 Compare April 27, 2023 08:42
@OmarIthawi OmarIthawi marked this pull request as ready for review April 27, 2023 08:59
@OmarIthawi
Copy link
Member Author

@mphilbrick211 this is now ready for review.

@mphilbrick211 mphilbrick211 removed blocked by other work PR cannot be finished until other work is complete waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. labels May 1, 2023
@mphilbrick211
Copy link

@mphilbrick211 this is now ready for review.

@itsjeyd FYI!

Copy link
Contributor

@brian-smith-tcril brian-smith-tcril left a comment

Choose a reason for hiding this comment

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

LGTM! Once conflicts are resolved let's :shipit:

@itsjeyd
Copy link

itsjeyd commented May 3, 2023

Thanks for the ping @mphilbrick211 :)

@itsjeyd itsjeyd added the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label May 3, 2023
This is an experimental off-by-defualt feature for moving the translation files ouside the repos.

Run `OPENEDX_ATLAS_PULL=true make translations` to use atlas to pull translations instead of transifex.
@OmarIthawi
Copy link
Member Author

Conflicts are fixed again. Thanks all for the reviews and help!!

@brian-smith-tcril brian-smith-tcril removed the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label May 3, 2023
@brian-smith-tcril
Copy link
Contributor

@itsjeyd conflicts are resolved on this one!

@itsjeyd
Copy link

itsjeyd commented May 9, 2023

@OmarIthawi @brian-smith-tcril Thanks for the update! Marking this as ready for merge.

@brian-smith-tcril If you have permission to merge (?) please go ahead, otherwise we can ping the Aurora team; let me know.

@brian-smith-tcril brian-smith-tcril merged commit d2de063 into openedx:master May 9, 2023
@openedx-webhooks
Copy link

@OmarIthawi 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

bra-i-am pushed a commit to eduNEXT/frontend-app-learning that referenced this pull request Nov 9, 2023
This is an experimental off-by-defualt feature for moving the translation files ouside the repos.

Run `OPENEDX_ATLAS_PULL=true make translations` to use atlas to pull translations instead of transifex.

Refs: FC-12 OEP-58
bra-i-am pushed a commit to eduNEXT/frontend-app-learning that referenced this pull request Nov 9, 2023
This is an experimental off-by-defualt feature for moving the translation files ouside the repos.

Run `OPENEDX_ATLAS_PULL=true make translations` to use atlas to pull translations instead of transifex.

Refs: FC-12 OEP-58
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
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants