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: avoid overriding manual edits for newer entries #2177

Merged
merged 4 commits into from
Nov 20, 2023

Conversation

OmarIthawi
Copy link
Member

@OmarIthawi OmarIthawi commented Nov 8, 2023

Problem

We've done about 200 manual fix on the https://app.transifex.com/open-edx/openedx-translations/ to fix translation validation issues in PRs such as d1ddaa7.

Those changes would be overridden on the next sync and needs to be fixed again.

For more information, please check this Slack Thread about the problem.

Solution

This pull request will only update the translation string if new translation is found:

newer_translation_found = new_project_translation_time > old_project_translation_time

TODO

  • Implement and test
  • Add unit tests
  • Test locally: $ make SYNC_ARGS=--dry-run TX_NEW_SLUG=course-discovery TX_OLD_SLUG=course_discovery TX_OLD_PROJECT_SLUG=edx-platform TX_LANGUAGES=es_419 sync_translations
  • Run sync again and ensure it's working as expected, without edx-platform repo resources
  • Run sync again and ensure it's working as expected, with edx-platform repo resources
  • Merge and unblock feat: FC-0012 - add atlas pull behind a flag edx-platform#33502

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

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

openedx-webhooks commented Nov 8, 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.

@OmarIthawi
Copy link
Member Author

Status: I'll pause working on this pull request until we're done with the edx platform backend work.

@@ -44,10 +44,6 @@ jobs:
old_slug: course_discovery
old_project_slug: edx-platform

- new_slug: course-discovery
Copy link
Member Author

Choose a reason for hiding this comment

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

duplicate, removed

@@ -181,7 +217,7 @@ def run_from_workflow_yaml_file(self, workflow_configs):
"""
Run the script from a GitHub Actions migrate-from-transifex-old-project.yml workflow file.
"""
pairs_list = workflow_configs['jobs']['migrate-translations']['strategy']['matrix']['batch']
pairs_list = workflow_configs['jobs']['migrate-translations']['strategy']['matrix']['resource']
Copy link
Member Author

Choose a reason for hiding this comment

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

the key name has changed, the sync is broken otherwise due to KeyError

if __name__ == '__main__':
command = Command(sys.argv, environ=os.environ, tx_api=transifex_api)
def main(): # pragma: no cover
parser = argparse.ArgumentParser(description=__doc__)
Copy link
Member Author

Choose a reason for hiding this comment

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

Added argparse to protect against argv typos.

@OmarIthawi OmarIthawi force-pushed the sync_no_override branch 2 times, most recently from 8209b9c to 537b62c Compare November 19, 2023 13:55
@OmarIthawi OmarIthawi marked this pull request as ready for review November 19, 2023 14:12
@OmarIthawi
Copy link
Member Author

@brian-smith-tcril @shadinaif this pull request is now ready for review.

current_translation_time = parse_tx_date(current_translation.datetime_translated)

if old_project_translation_time and current_translation_time:
newer_translation_found = current_translation_time > old_project_translation_time
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the gist of the pull request.

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 great! Thank you so much for this!

@brian-smith-tcril brian-smith-tcril merged commit 4de48d8 into openedx:main Nov 20, 2023
5 checks passed
@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.

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.

4 participants