forked from open-contracting/standard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_docs.sh
executable file
·41 lines (37 loc) · 1.82 KB
/
build_docs.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
set -e
mkdir -p standard/docs/field_definitions
cd standard
python schema/utils/make_field_definitions.py
CODELIST_LANG=en python schema/utils/translate_codelists.py
sphinx-build -b dirhtml docs/en ../build/en
sphinx-build -b gettext docs/en ../build/locale
# Remove messages from CSVs from Sphinx's own translations as we translate the
# schema and codelists separately.
for name in reference records_reference; do
msggrep -v -N '../../standard/docs/field_definitions/*.csv' ../build/locale/schema/${name}.pot > TMP
mv TMP ../build/locale/schema/${name}.pot
done
msggrep -v -N '../../standard/schema/codelists_translated/*.csv' ../build/locale/schema/codelists.pot > TMP
mv TMP ../build/locale/schema/codelists.pot
msggrep -v -N '../../standard/docs/en/examples/*.csv' ../build/locale/implementation/serialization.pot > TMP
mv TMP ../build/locale/implementation/serialization.pot
msggrep -v -N '../../standard/example/*.csv' ../build/locale/schema/reference.pot > TMP
mv TMP ../build/locale/schema/reference.pot
pybabel extract -F .babel_schema . -o ../build/locale/schema.pot
pybabel extract -F .babel_codelists . -o ../build/locale/codelists.pot
pybabel compile -d docs/locale -D schema
pybabel compile -d docs/locale -D codelists
cd ..
cp -r standard/assets build
cp standard/schema/*.json build/en/
# can put multiple languages i.e translate_schema.py en fr
python standard/schema/utils/translate_schema.py es fr
cd standard
# all these need to be run per language
SCHEMA_LANG=es python schema/utils/make_field_definitions.py
CODELIST_LANG=es python schema/utils/translate_codelists.py
sphinx-build -b dirhtml -D language='es' docs/en ../build/es
SCHEMA_LANG=fr python schema/utils/make_field_definitions.py
CODELIST_LANG=fr python schema/utils/translate_codelists.py
sphinx-build -b dirhtml -D language='fr' docs/en ../build/fr