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: standardize make extract_translations #316

Merged
merged 3 commits into from
Apr 18, 2023

Conversation

shadinaif
Copy link
Contributor

@shadinaif shadinaif commented Mar 13, 2023

feat: standardize make extract_translations

This PR prepares the repository to comply with openedx-translations by doing the following:

  • Move all local translations to conf/locale and convert translations into a symbolic link to conf/locale. The reason behind that is to comply with openedx-translations mechanism that requires translation files to be in conf/locale directory. This fix will avoid the need to modify find commands here
  • For the same reason above, locale now linked to conf/locale instead of translations
  • Make the translation command make extract_translations build a file named django.po instead of text.po. And create a symbolic link from text.po to django.po. This is because openedx-translations requires django.po as the name of the file. And it must be a valid file (not a link) because it uses git add here
  • Tested on local tutor to ensure that everything renders fine
  • Tested on local tutor to ensure that local translation still works

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

For XBlocks:

  • The standard translation path must be conf/locale. Therefore, we are creating a link from conf/locale to translations so Atlas can find the path without disrupting the current way of having translations locally within the XBlocks
  • openedx-translations will have a related PR that adds the XBlock to the pipeline. This will not affect the current way of managing/updating translations
  • At the end of the project, a clear change log will be added and all translations will be handled by Atlas. Thus, the local translation will be removed from the repo within the version bump
  • A notification for the community will be published to ensure that everyone knows why translations directories are removed from all repos

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

Thanks for the pull request, @shadinaif! 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.

1 similar comment
@openedx-webhooks
Copy link

Thanks for the pull request, @shadinaif! 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.

shadinaif added a commit to zeit-labs/openedx-translations that referenced this pull request Mar 13, 2023
@itsjeyd
Copy link
Contributor

itsjeyd commented Mar 14, 2023

@shadinaif Thank you for your contribution!

It looks like one of the CI checks did not pass. Could you please look into that?

Once the build is green we'll get this PR lined up for engineering review.

@itsjeyd itsjeyd added the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label Mar 14, 2023
@OmarIthawi
Copy link
Member

@shadinaif I see the error in the logs:

ModuleNotFoundError: No module named 'drag_and_drop_v2.locale.settings'

I think it has to do with the missing setting of Django setting, which in turn is inferred therefore is setting incorrectly to drag_and_drop_v2.locale.settings.

@shadinaif
Copy link
Contributor Author

@OmarIthawi thank you, I run tox without defining an env -e to test all combinations, but the tox file is not defining those envs in envlist. So, I missed it!

Now the error is disturbing, we can add settings.py to conf.locale to let it pass, it's calling make check_translations_up_to_date. But the goal is to cut off this translation mechanism 😕

Should we fix it now, then remove the test when removing translations directory? or should we stop these tests as they are not making sense anymore?!

@OmarIthawi
Copy link
Member

OmarIthawi commented Mar 16, 2023

fd9564f added this check.

@shadinaif Yes, the translations ci check can be removed in my opinion.

.github/workflows/ci.yml Outdated Show resolved Hide resolved
drag_and_drop_v2/locale Outdated Show resolved Hide resolved
@itsjeyd
Copy link
Contributor

itsjeyd commented Mar 28, 2023

Hey @shadinaif, a friendly reminder to follow up on the latest comments from @Agrendalath above.

@shadinaif
Copy link
Contributor Author

Hi @itsjeyd and @Agrendalath , thank you for your patience on this. I'll push an update and address the issues above very soon. We decided to finish the project without introducing any breaking changes until the last phase of it. I'll add a detailed description to the PR, we're working on a template for that

Thank you!

@itsjeyd
Copy link
Contributor

itsjeyd commented Mar 30, 2023

Sounds good, thank you for the update @shadinaif!

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch 4 times, most recently from f1c6412 to 8eebb49 Compare April 10, 2023 04:40
@shadinaif
Copy link
Contributor Author

@OmarIthawi @Agrendalath @itsjeyd , this one is ready for your review again. Thank you!

@shadinaif shadinaif requested a review from Agrendalath April 10, 2023 04:41
shadinaif added a commit to zeit-labs/openedx-translations that referenced this pull request Apr 10, 2023
@itsjeyd itsjeyd removed the waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. label Apr 13, 2023
Copy link
Member

@Agrendalath Agrendalath left a comment

Choose a reason for hiding this comment

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

@shadinaif, please bump the PATCH version in __init__.py and add a Changelog entry.

drag_and_drop_v2/locale Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
Makefile Show resolved Hide resolved
shadinaif added a commit to zeit-labs/openedx-translations that referenced this pull request Apr 15, 2023
@shadinaif
Copy link
Contributor Author

Thank you @Agrendalath , please take a look now

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch from d0b220d to 7c6cb06 Compare April 15, 2023 13:00
Copy link
Member

@OmarIthawi OmarIthawi left a comment

Choose a reason for hiding this comment

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

@shadinaif I'll leave further reviews to @Agrendalath. He's making great reviews already :)

@shadinaif
Copy link
Contributor Author

@Agrendalath @OmarIthawi please note that tests are failing because of codecov package has been completely removed from pypi . The new way to upload is needed https://docs.codecov.com/docs/codecov-uploader

@Agrendalath
Copy link
Member

Agrendalath commented Apr 17, 2023

@shadinaif, I took care of the codecov. Would you mind rebasing this on the master branch?

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch from 7c6cb06 to 6e68599 Compare April 18, 2023 05:47
@shadinaif
Copy link
Contributor Author

Thank you @Agrendalath , rebased!

Copy link
Member

@Agrendalath Agrendalath left a comment

Choose a reason for hiding this comment

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

👍

  • I tested this: verified that translations are included in the Python package and work correctly when installed in a non-editable mode
  • I read through the code
  • I checked for accessibility issues: n/a
  • Includes documentation: n/a
  • I made sure any change in configuration variables is reflected in the corresponding client's configuration-secure repository: n/a

@Agrendalath Agrendalath merged commit a95a9b5 into openedx:master Apr 18, 2023
@openedx-webhooks
Copy link

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

1 similar comment
@openedx-webhooks
Copy link

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

shadinaif added a commit to zeit-labs/openedx-translations that referenced this pull request May 14, 2023
@shadinaif shadinaif deleted the shadinaif/FC-0012-OEP-58 branch August 14, 2023 10:45
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