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

Commitbd7c059

Browse files
rffontenellehugovkezio-melotti
authored
Apply suggestions from code review
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
1 parent541c7a5 commitbd7c059

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

‎.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
matrix:
5757
os:["ubuntu-latest", "windows-latest"]
5858
# Test minimum supported and latest stable from 3.x series
59-
python-version:["3.8", "3"]
59+
python-version:["3.9", "3"]
6060
steps:
6161
-uses:actions/checkout@v4
6262
-uses:actions/setup-python@v5

‎babel_runner.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def get_project_info() -> dict:
3434
returndata["project"]
3535

3636

37-
defextract_messages():
37+
defextract_messages()->None:
3838
"""Extract messages from all source files into message catalog template"""
3939
Path(PROJECT_DIR,LOCALES_DIR).mkdir(parents=True,exist_ok=True)
4040
project_data=get_project_info()
@@ -61,7 +61,7 @@ def extract_messages():
6161
)
6262

6363

64-
definit_locale(locale:str):
64+
definit_locale(locale:str)->None:
6565
"""Initialize a new locale based on existing message catalog template"""
6666
pofile=PROJECT_DIR/LOCALES_DIR/locale/"LC_MESSAGES"/f"{DOMAIN}.po"
6767
ifpofile.exists():
@@ -71,23 +71,23 @@ def init_locale(locale: str):
7171
subprocess.run(cmd,cwd=PROJECT_DIR,check=True)
7272

7373

74-
defupdate_catalogs(locale:str):
74+
defupdate_catalogs(locale:str)->None:
7575
"""Update translations from existing message catalogs"""
7676
cmd= ["pybabel","update","-i",POT_FILE,"-d",LOCALES_DIR]
77-
iflocale!="":
77+
iflocale:
7878
cmd.extend(["-l",locale])
7979
subprocess.run(cmd,cwd=PROJECT_DIR,check=True)
8080

8181

82-
defcompile_catalogs(locale:str):
82+
defcompile_catalogs(locale:str)->None:
8383
"""Compile existing message catalogs"""
8484
cmd= ["pybabel","compile","-d",LOCALES_DIR]
85-
iflocale!="":
85+
iflocale:
8686
cmd.extend(["-l",locale])
8787
subprocess.run(cmd,cwd=PROJECT_DIR,check=True)
8888

8989

90-
defmain():
90+
defmain()->None:
9191
parser=argparse.ArgumentParser(description=__doc__)
9292
parser.add_argument(
9393
"command",
@@ -97,16 +97,17 @@ def main():
9797
parser.add_argument(
9898
"-l",
9999
"--locale",
100+
default="",
100101
help="language code (needed for init, optional for update and compile)",
101102
)
102103

103104
args=parser.parse_args()
104-
locale=args.localeifargs.localeelse""
105+
locale=args.locale
105106

106107
ifargs.command=="extract":
107108
extract_messages()
108109
elifargs.command=="init":
109-
iflocale=="":
110+
ifnotlocale:
110111
parser.error("init requires passing the --locale option")
111112
init_locale(locale)
112113
elifargs.command=="update":

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp