Skip to content

Commit faf0311

Browse files
committed
fixup! feat: Add aider translation support
1 parent 8ad024b commit faf0311

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

Diff for: .scripts/intercept.py

+18-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
1-
# /// script
2-
# dependencies = [
3-
# "polib",
4-
# ]
5-
# ///
1+
"""
2+
A utility script to extract message IDs from PO files.
3+
4+
This script extracts a specific message ID from a PO file based on the file name
5+
and occurrence number. It's useful for retrieving translation strings for
6+
specific occurrences in the Python documentation.
7+
8+
Usage:
9+
python intercept.py path/to/file.po [-n OCCURRENCE_NUMBER]
10+
11+
Arguments:
12+
path: Path to a PO file
13+
-n, --occurrence_number: The occurrence number to match (default: 1)
14+
"""
615
import argparse
716
from pathlib import Path
817

@@ -24,11 +33,13 @@ def get_pofile_from_path(path: Path) -> polib.POFile:
2433

2534

2635
if __name__ == '__main__':
27-
parser = argparse.ArgumentParser()
36+
parser = argparse.ArgumentParser(
37+
description="Extract message IDs from PO files"
38+
)
2839
parser.add_argument("path", type=Path,
2940
help="the path of a PO file")
3041
parser.add_argument("-n", '--occurrence_number',
31-
type=int, default=1)
42+
type=int, default=1, help="the occurrence number to match")
3243
args = parser.parse_args()
3344
path = args.path.resolve()
3445
pofile = get_pofile_from_path(path)

0 commit comments

Comments
 (0)