@@ -41,6 +41,7 @@ SPHINX_CONF := $(CPYTHON_CLONE)/Doc/conf.py
41
41
LANGUAGE := zh_TW
42
42
LC_MESSAGES := $(CPYTHON_CLONE ) /Doc/locales/$(LANGUAGE ) /LC_MESSAGES
43
43
VENV := ~/.venvs/python-docs-i18n/
44
+ VENV_FOR_SCRIPT := ~/.venvs/python-docs-zhtw-script/
44
45
PYTHON := $(shell which python3)
45
46
MODE := autobuild-dev-html
46
47
BRANCH := $(or $(VERSION ) , $(shell git describe --contains --all HEAD) )
@@ -75,6 +76,33 @@ $(VENV)/bin/sphinx-lint: $(VENV)/bin/activate
75
76
$(VENV ) /bin/blurb : $(VENV ) /bin/activate
76
77
. $(VENV ) /bin/activate; python3 -m pip install blurb
77
78
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
+
78
106
79
107
.PHONY : upgrade_venv
80
108
upgrade_venv : $(VENV ) /bin/activate # # Upgrade the venv that compiles the doc
0 commit comments