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

Commitc96d8ea

Browse files
committed
chore: move scripts to makefile, except from_cn
1 parent19039a0 commitc96d8ea

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

‎.scripts/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
polib==1.1.1
2+
googletrans==3.1.0a0
3+
translate-toolkit==3.8.1
4+
requests==2.31.0

‎Makefile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py
4141
LANGUAGE := zh_TW
4242
LC_MESSAGES :=$(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES
4343
VENV := ~/.venvs/python-docs-i18n/
44+
VENV_FOR_SCRIPT := ~/.venvs/python-docs-zhtw-script/
4445
PYTHON :=$(shell which python3)
4546
MODE := autobuild-dev-html
4647
BRANCH :=$(or$(VERSION),$(shell git describe --contains --all HEAD))
@@ -75,6 +76,33 @@ $(VENV)/bin/sphinx-lint: $(VENV)/bin/activate
7576
$(VENV)/bin/blurb:$(VENV)/bin/activate
7677
.$(VENV)/bin/activate; python3 -m pip install blurb
7778

79+
$(VENV_FOR_SCRIPT)/bin/activate:
80+
mkdir -p$(VENV_FOR_SCRIPT)
81+
$(PYTHON) -m venv$(VENV_FOR_SCRIPT)
82+
.$(VENV_FOR_SCRIPT)/bin/activate; python3 -m pip install -r .scripts/requirements.txt
83+
84+
.PHONY: summarize_progress
85+
summarize_progress:$(VENV_FOR_SCRIPT)/bin/activate
86+
cd .scripts&&\
87+
.$(VENV_FOR_SCRIPT)/bin/activate;\
88+
python3 summarize_progress/main.py
89+
90+
.PHONY: google_translate
91+
google_translate:$(VENV_FOR_SCRIPT)/bin/activate
92+
if [-z$(filter-out$@,$(MAKECMDGOALS)) ];then \
93+
echo"Please provide a file argument.";\
94+
exit 1;\
95+
fi
96+
97+
@$(eval __target=$(filter-out $@,$(MAKECMDGOALS)))
98+
@$(eval __filepath=$(addprefix ../,$(__target)))
99+
@$(eval __temp_po_file=tmp.po)
100+
101+
cd .scripts && \
102+
. $(VENV_FOR_SCRIPT)/bin/activate; \
103+
python3 google_translate/main.py $(__filepath) > $(__temp_po_file) ; pomerge -t $(__filepath) -i $(__temp_po_file) -o $(__filepath); rm "$(__temp_po_file)"
104+
exit 0
105+
78106

79107
.PHONY: upgrade_venv
80108
upgrade_venv:$(VENV)/bin/activate## Upgrade the venv that compiles the doc

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp