Skip to content

Commit 2be9f1c

Browse files
committed
Introduces a lightweight, more efficient way of validating translations.
Instead of building HTML, this update changes the target to plaintext. This significantly reduces the overhead associated with HTML rendering, resulting in a more efficient validation process. On my device, it reduces around 85% of the validation time. Additionally, for local translations, this commit introduces an incremental build, replacing the full build. This change reduces the validation process time from approximately 20 minutes to just a few seconds on a local device.
1 parent 010898f commit 2be9f1c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Here is what you can do:
44
#
55
# - make all # Automatically build an html local version
6+
# - make validate # Validate translation (.po) files
67
# - make todo # To list remaining tasks
78
# - make merge # To merge pot from upstream
89
# - make fuzzy # To find fuzzy strings
@@ -73,6 +74,13 @@ $(VENV)/bin/sphinx-build: $(VENV)/bin/activate
7374
$(VENV)/bin/blurb: $(VENV)/bin/activate
7475
. $(VENV)/bin/activate; python3 -m pip install blurb
7576

77+
.PHONY: validate
78+
validate: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone ## Automatically build an html local version
79+
mkdir -p $(LC_MESSAGES)
80+
for dirname in $$(find . -name '*.po' | xargs -n1 dirname | sort -u | grep -v '^\.$$'); do mkdir -p $(LC_MESSAGES)/$$dirname; done
81+
for file in *.po */*.po; do ln -f $$file $(LC_MESSAGES)/$$file; done
82+
. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D locale_dirs=locales -D language=$(LANGUAGE) -D gettext_compact=0' text
83+
7684

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

README.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,11 @@ the PSF for inclusion in the documentation.
133133

134134
poedit glossary.po
135135

136-
3. 存檔以後,執行以下列指令編譯輸出文件,以確保你的修改沒有 rST 的語法錯誤或警告 ::
136+
3. 存檔以後,執行以下列指令檢查翻譯檔,以確保你的修改沒有 rST 的語法錯誤或警告 ::
137+
138+
VERSION=3.11 make validate
139+
140+
或者輸出完整html文件 ::
137141

138142
VERSION=3.11 make all
139143

0 commit comments

Comments
 (0)