From ac9f54cddb19b6a81ef79bbbf1d581ceb837d167 Mon Sep 17 00:00:00 2001 From: gilgamezh Date: Sat, 2 May 2020 18:44:41 +0200 Subject: [PATCH 1/2] show tutorial progress --- Makefile | 5 +++++ requirements.txt | 1 + scripts/print_percentage.py | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 scripts/print_percentage.py diff --git a/Makefile b/Makefile index 63ef93544b..aa35fb8cab 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,7 @@ help: @echo " pot Create/Update POT files from source files" @echo " serve Serve a built documentation on http://localhost:8000" @echo " spell Check spelling, storing output in $(POSPELL_TMP_DIR)" + @echo " progress To compute current progression on the tutorial" @echo "" @@ -202,3 +203,7 @@ clean: rm -fr $(VENV) rm -rf $(POSPELL_TMP_DIR) find -name '*.mo' -delete + +.PHONY: progress +progress: venv + $(VENV)/bin/python scripts/print_percentage.py diff --git a/requirements.txt b/requirements.txt index 77a79af888..15d8647ee8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,6 @@ Sphinx==2.2.0 blurb +polib pospell powrap python-docs-theme diff --git a/scripts/print_percentage.py b/scripts/print_percentage.py new file mode 100644 index 0000000000..1f38fe8e62 --- /dev/null +++ b/scripts/print_percentage.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python + +import glob +import os + +import polib # fades + +PO_DIR = os.path.abspath( + os.path.join( + os.path.dirname(__file__), + '..', + )) + + +def main(): + for pofilename in glob.glob(PO_DIR + '**/tutorial/*.po'): + po = polib.pofile(pofilename) + file_per = po.percent_translated() + print(f"{pofilename} ::: {file_per}%") + + +if __name__ == "__main__": + main() From 497bce74435ea9a6ef151fb043f61ea98bab4d43 Mon Sep 17 00:00:00 2001 From: gilgamezh Date: Sat, 2 May 2020 18:48:22 +0200 Subject: [PATCH 2/2] replace tab --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index aa35fb8cab..8776885272 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ help: @echo " pot Create/Update POT files from source files" @echo " serve Serve a built documentation on http://localhost:8000" @echo " spell Check spelling, storing output in $(POSPELL_TMP_DIR)" - @echo " progress To compute current progression on the tutorial" + @echo " progress To compute current progression on the tutorial" @echo ""