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: make extract_translations to use i18n_tool #613

Merged

Conversation

shadinaif
Copy link
Contributor

@shadinaif shadinaif commented Apr 20, 2023

feat: make extract_translations to use i18n_tool

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

  • Move local translations from locale to conf/locale directory. This is the default used one in openedx-translations
  • Create a symbolic link from locale to conf/locale for backward compatibility
  • Use i18_tool extract to extract transactions
  • Avoid using i18_tool validate that requires po files metadata to be filled. This is because we'll not be using these metadata anymore when we completely move to OEP-58 ... edx-i18n-tools>=1.3.0 fixes the issue
  • Tested on local devstack palm to ensure that everything renders fine
  • Tested on local devstack palm 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 the open-source-contribution PR author is not from Axim or 2U label Apr 20, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Apr 20, 2023

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.

@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Apr 20, 2023
@mphilbrick211
Copy link

@e0d would you mind running tests for this one? It's for FC-0012.

@e0d e0d removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Apr 21, 2023
@e0d
Copy link
Contributor

e0d commented Apr 21, 2023 via email

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 was assuming that this repo only needed a symlink (ln -s) for the conf/locale directory.

I'm not sure if Makefile needs to be updated at all.

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch 2 times, most recently from 7128fe0 to a5166cb Compare April 26, 2023 13:07
@shadinaif
Copy link
Contributor Author

shadinaif commented Apr 26, 2023

I've reverted Makefile changes @OmarIthawi . But still not convinced, unless I got something wrong regarding the proposal. I thought we must eliminate all use of direct django-admin calls and use i18n_tool instead

Thank you for msgcat suggestion, but it replaces the text too and the error is still being raised

So, I believe now we have four options:

  • option1: Keep Makefile untouched because I understood the requirements the wrong way
  • option2: Update the current flow to use extract_translations_for_ci until we remove local translations. And add a new extract_translations to be used by openedx-translations
  • option3: Fix i18n_tool because we need those headers filled correctly when openedx-translations extracts translations
  • option4: Keep this Makefile file untouched and fix all other Makefile to use django-admin instead of i18n_tool because we need the correct headers but we don't want to fix i18n_tool. edit: this option will not fix the header for new files, and will not fix the header after we remove all local translations!

Sorry if I made it looks like a mess, but I'm sure it's not

@OmarIthawi
Copy link
Member

OmarIthawi commented Apr 26, 2023

we must eliminate all use of direct django-admin calls and use i18n_tool instead

@shadinaif I'm not sure if that's a requirement. Nothing in the OEP-58 document says that. The requirements I'm aware of is to have make extract_translations work reliably in a standard way and paths should be standardized to roughly conf/locale/**/{django,djangojs}.po for python projects and src/i18n/transifex_input.json for MFEs.

option1: Keep Makefile untouched because I understood the requirements the wrong way

I think it's just that. In my opinion, depending on the context, we can use either django-admin directly or i18n_tools when needed. i18n_tools is very useful for the edx-platform repo.

Let's confirm with others first.

@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Apr 26, 2023
@e0d e0d added waiting on author PR author needs to resolve review requests, answer questions, fix tests, etc. and removed needs test run Author's first PR to this repository, awaiting test authorization from Axim labels Apr 27, 2023
@e0d
Copy link
Contributor

e0d commented Apr 27, 2023

@shadinaif this PR is still marked as draft, let us know when it is ready to review.

@shadinaif
Copy link
Contributor Author

Note: I'll be working on this tomorrow

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch from a5166cb to 4ff76ee Compare June 9, 2023 14:35
shadinaif added a commit to zeit-labs/openedx-translations that referenced this pull request Jun 9, 2023
shadinaif added a commit to zeit-labs/openedx-translations that referenced this pull request Jun 9, 2023
shadinaif added a commit to zeit-labs/openedx-translations that referenced this pull request Jun 9, 2023
shadinaif added a commit to zeit-labs/openedx-translations that referenced this pull request Jun 9, 2023
@shadinaif shadinaif marked this pull request as ready for review June 10, 2023 13:26
@shadinaif
Copy link
Contributor Author

shadinaif commented Jun 10, 2023

@OmarIthawi @brian-smith-tcril please review. Also, I didn't test it on devstack because I think it'll consume a lot of time. We actually didn't change anything significant in the repo. Or must I?

@shadinaif shadinaif requested a review from OmarIthawi June 10, 2023 13:28
@shadinaif
Copy link
Contributor Author

@e0d @hurtstotouchfire this part of FC-0012 as in the description. please review. Also, I didn't test it on devstack because I think it'll consume a lot of time. We actually didn't change anything significant in the repo. Or must I?

@OmarIthawi
Copy link
Member

@e0d @hurtstotouchfire this part of FC-0012 as in the description. please review. Also, I didn't test it on devstack because I think it'll consume a lot of time. We actually didn't change anything significant in the repo. Or must I?

As far as I know, all PRs should be tested before merging. It takes time, but testing is part of the FC-0012 project.

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch from 4ff76ee to 5122171 Compare July 20, 2023 08:58
@brian-smith-tcril
Copy link

@shadinaif the PR description still shows you haven't tested this. Is that accurate and this still needs testing, or is that inaccurate and this is ready for review?

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch from 65d01dd to 267c6b2 Compare September 18, 2023 11:40
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Sep 18, 2023
@OmarIthawi
Copy link
Member

@hurtstotouchfire we've been asked to inform you about the change to this repository.

Please check this pull request and let us know if you have any questions.

cc: @brian-smith-tcril @shadinaif

@OmarIthawi OmarIthawi removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Sep 21, 2023
shadinaif added a commit to zeit-labs/openedx-translations that referenced this pull request Sep 21, 2023
@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch from 267c6b2 to 5e1f3c7 Compare September 26, 2023 07:26
@OmarIthawi
Copy link
Member

@brian-smith-tcril @hurtstotouchfire Would you mind reviewing this and merging it?

We're aiming to make a backward-compatible pull request.

@OmarIthawi
Copy link
Member

Tests run

@OmarIthawi
Copy link
Member

@mphilbrick211 @e0d another test run for this FC-0012 pull request please.

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch from 5e1f3c7 to f29dfa6 Compare October 10, 2023 07:39
@shadinaif
Copy link
Contributor Author

I've rebased on master, please run tests, and maybe merge @mphilbrick211 @e0d

cc: @OmarIthawi

@OmarIthawi
Copy link
Member

OmarIthawi commented Oct 10, 2023

Thanks Shadi.

@mphilbrick211 is it possible to enable me and/or other Core Contributors to approve workflow runs?

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch from f29dfa6 to 52b31fa Compare October 16, 2023 05:14
@OmarIthawi
Copy link
Member

@e0d @brian-smith-tcril @hurtstotouchfire please approve the GitHub Actions workflow and kindly review and merge the PR.

It's a been a while since this PR has been opened.

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch from 52b31fa to bffc42a Compare October 16, 2023 09:32
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.

LGTM. Thanks @shadinaif!

@mphilbrick211 mphilbrick211 requested a review from a team October 16, 2023 16:25
@hurtstotouchfire
Copy link
Member

Hi all, I was under the impression that we would just be informed, and that we had no blocking role, so we have not been following closely. @e0d / @brian-smith-tcril Do you want us to handle this? From my perspective you were good to merge this on your own whenever you want.

@brian-smith-tcril
Copy link

I've completed my review of this. @hurtstotouchfire I'm pinging you since you're listed as "please inform" on the spreadsheet. I plan on merging this by EOD today. If you have any objections please let me know. Thanks!

@OmarIthawi
Copy link
Member

Thanks @hurtstotouchfire and @brian-smith-tcril for triaging this.

It's only been practically ready for merge two weeks ago, before that it's been blocked by other work on i18n-tools. I've got confused and said "it's been open for a while".

Thanks again!!

@brian-smith-tcril
Copy link

@shadinaif it looks like this needs another rebase before it can be merged. As soon as it's up to date with the base branch I'll merge it.

@shadinaif shadinaif force-pushed the shadinaif/FC-0012-OEP-58 branch from bffc42a to c11cf67 Compare October 18, 2023 04:56
@brian-smith-tcril brian-smith-tcril merged commit 386dbe2 into openedx:master Oct 18, 2023
2 checks passed
@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 shadinaif deleted the shadinaif/FC-0012-OEP-58 branch October 18, 2023 17:08
brian-smith-tcril pushed a commit to openedx/openedx-translations that referenced this pull request Oct 25, 2023
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: Done
Archived in project
Development

Successfully merging this pull request may close these issues.

7 participants