Skip to content

Commit ac9f54c

Browse files
committed
show tutorial progress
1 parent 9638aea commit ac9f54c

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

Makefile

+5
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ help:
3434
@echo " pot Create/Update POT files from source files"
3535
@echo " serve Serve a built documentation on http://localhost:8000"
3636
@echo " spell Check spelling, storing output in $(POSPELL_TMP_DIR)"
37+
@echo " progress To compute current progression on the tutorial"
3738
@echo ""
3839

3940

@@ -202,3 +203,7 @@ clean:
202203
rm -fr $(VENV)
203204
rm -rf $(POSPELL_TMP_DIR)
204205
find -name '*.mo' -delete
206+
207+
.PHONY: progress
208+
progress: venv
209+
$(VENV)/bin/python scripts/print_percentage.py

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Sphinx==2.2.0
22
blurb
3+
polib
34
pospell
45
powrap
56
python-docs-theme

scripts/print_percentage.py

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env python
2+
3+
import glob
4+
import os
5+
6+
import polib # fades
7+
8+
PO_DIR = os.path.abspath(
9+
os.path.join(
10+
os.path.dirname(__file__),
11+
'..',
12+
))
13+
14+
15+
def main():
16+
for pofilename in glob.glob(PO_DIR + '**/tutorial/*.po'):
17+
po = polib.pofile(pofilename)
18+
file_per = po.percent_translated()
19+
print(f"{pofilename} ::: {file_per}%")
20+
21+
22+
if __name__ == "__main__":
23+
main()

0 commit comments

Comments
 (0)