-
Notifications
You must be signed in to change notification settings - Fork 0
Add Reusable GitHub Action for Auto-Translation via Azure AI Translation #45
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have another question regarding strings that contain placeholders. How does the AI handle them? Have we tested this scenario?
For example, if I have a string like "Order %s completed", where %s could be something like the order number, how is it processed by the AI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some feedback for you @mr-vara! I have an additional request, a question, and sharing a little research I did.
Request: Could you also open a pull request for one repo that will utilize this to demonstrate how this workflow will be called? That will help me see the full picture.
Question: Are there any reasons why this should be done in a separate pull request than a PR? For example, if a PR changes some text strings, why would we not want the translations to be updated at the same time? If it's a cost issue (repeatedly translating a string that changes multiple times), we could set the workflow up to only run when certain actions are taken (a specific label is applied, the PR receives an approving review, etc.). That would avoid forgetting to update translations, merge them contextually with the associated code changes, make the translation changes available while testing the PR, etc.
One thing that I considered while reviewing is that it seems odd we would need to write our own script to perform the translations. I did some searching, and there are a few actions that seem related but I don't believe fit our specific use case. I also looked at the https://github.com/Azure/cli repository, but that also does not appear to satisfy the requirements.
There is no direct way, but we can still provide context for the same in the workaround way. |
Thank you for the review @desrosj I'll address them and will test it in my test repositories and let you know when it is ready for re-review.
I've created one for Bluehost Plugin here.
I may not be the final decision-maker on this, but I’d like to share the current thinking and invite feedback or suggestions. There are a few reasons why translations are currently handled in a separate pull request:
Potential Middle Ground: Open to thoughts or alternative approaches!
I agree with you regarding writing our own script. Yes, it's odd, but I feel we left with no other choices. I'm open to alternative approaches, if we have any. |
Thanks! For the reasons to keep translations separate, I think all of those make sense. Especially making the review of the suggested translations from AI a separate and more intentional process. 👍 |
And as per your suggestion in private chat, @desrosj
I'll make sure to exclude the workflow-repo directory from any translation tasks, and delete the directory immediately after running the script. I'll test this first in my personal repositories and will update here. |
@desrosj I have addressed the suggestions. For the Python script separation, I've downloaded the file instead of checking out to the entire workflows repo. Please let me know if you think otherwise. |
I'm hoping to re-review this today. @mr-vara I just wanted to check that you're happy with where this is at to avoid any reviews from being dismissed for other small changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mr-vara! Great work. I think that this is really close.
Co-authored-by: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com>
Co-authored-by: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com>
Co-authored-by: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com>
Co-authored-by: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com>
Co-authored-by: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com>
Co-authored-by: Jonathan Desrosiers <359867+desrosj@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, @mr-vara! Thanks for all of your work on this.
Proposed changes
This PR introduces a reusable GitHub Actions workflow that automates the translation of
.po
and.json
localization files using Azure AI Translation (Microsoft Translator), followed by creating a pull request with the translated content.Key Features
.po
and WordPress-style.json
files.text_domain
input; defaults to the invoking repository name if not provided.Required Secrets (to be passed by child repositories)
TRANSLATOR_API_KEY
: Azure AI Translation (Microsoft Translator) API Key. (This secret needs to be set on org level)NEWFOLD_ACCESS_TOKEN
: GitHub token withrepo
andpull_request
scope for PR creation.This shared workflow helps maintain translation consistency across multiple repositories, while centralizing the logic for easy maintenance and scalability.
Documentation
AI Translation Workflow Documentation