Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfaf0311

Browse files
committed
fixup! feat: Add aider translation support
1 parent8ad024b commitfaf0311

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

‎.scripts/intercept.py

Lines changed: 18 additions & 7 deletions
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
importargparse
716
frompathlibimportPath
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)

[8]ページ先頭

©2009-2025 Movatter.jp