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 aider translation support #1006

Open
wants to merge 1 commit into
base: 3.13
Choose a base branch
from
Open

Conversation

josix
Copy link
Collaborator

@josix josix commented Dec 16, 2024

This pull request introduces a new script for handling .po files and updates the Makefile to include a new translation target using the aider-chat tool. The most important changes are detailed below:

New Script for .po File Handling:

  • .scripts/intercept.py: Added a new script to handle .po files, which includes functionality to parse the file and retrieve specific entries based on their occurrences.

Makefile Enhancements:

  • Makefile: Added a new target to install the aider-chat tool in the virtual environment.
  • Makefile: Introduced a new translate target that uses the aider-chat tool to translate Python documentation into Traditional Chinese. This target requires FILE and LINE arguments to specify the .po file and the line number to translate.

Example
image

Co-Authored-By: Wei-Hsiang (Matt) Wang <[email protected]>
Co-Authored-By: Becca <[email protected]>
@josix josix force-pushed the feat/aider-translation branch from 4695a29 to c13a0ab Compare December 16, 2024 10:56
Copy link
Member

Choose a reason for hiding this comment

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

I would add a module docstring and a description to argparse.ArgumentParser(description=...) to clarify what this script does.

Comment on lines +28 to +34
parser.add_argument(
"path",
help="the path of a PO file",
)
parser.add_argument("-n", '--occurrence_number', type=int, default=1)
args = parser.parse_args()
path = Path(args.path).resolve()
Copy link
Member

Choose a reason for hiding this comment

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

Add type=Path, and reformat to be more consistent:

Suggested change
parser.add_argument(
"path",
help="the path of a PO file",
)
parser.add_argument("-n", '--occurrence_number', type=int, default=1)
args = parser.parse_args()
path = Path(args.path).resolve()
parser.add_argument("path", type=Path,
help="the path of a PO file")
parser.add_argument("-n", '--occurrence_number',
type=int, default=1)
args = parser.parse_args()
path = args.path.resolve()

I would also add a help= for -n.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants