Skip to content
Snippets Groups Projects
Commit a1443dea authored by Jean-Noël Avila's avatar Jean-Noël Avila
Browse files

convert creation of po4a.conf to a python script


We unify the creation of po4a.conf in a python script. This
script is called by the Makefile.

Signed-off-by: default avatarJean-Noël Avila <jn.avila@free.fr>
parent b362851f
No related branches found
No related tags found
No related merge requests found
......@@ -15,8 +15,8 @@ ifndef V
endif
endif
po4a.conf: scripts/create_po4a_conf.sh sources.txt $(LANGUAGE_PO)
@./scripts/create_po4a_conf.sh
po4a.conf: scripts/create_po4a_conf sources.txt $(LANGUAGE_PO)
@./scripts/create_po4a_conf
po4a-stamp: po4a.conf $(EN_SOURCES) $(LANGUAGE_PO) Makefile
$(QUIET_PO4A)PERL5LIB=./po4a/lib po4a/po4a -v po4a.conf
......
#!/usr/bin/env python3
import glob
with open('po4a.conf', 'w') as f:
f.write('[po4a_langs]')
langs = [ l[17:-3] for l in glob.glob('po/documentation.*.po')]
langs.sort()
f.write(' '.join(langs))
f.write('\n[po4a_paths] po/documentation.pot $lang:po/documentation.$lang.po\n[options] opt: " -k 80"\n')
with open('sources.txt', 'r') as sources:
for source in sources:
source = source.strip()
f.write(f"[type: asciidoc] en/{source} $lang:./$lang/{source}")
if source.startswith('git'):
f.write(' add_$lang:?addenda/addendum.$lang.txt\n')
else:
f.write('\n')
#!/bin/bash
echo -n "[po4a_langs]" >po4a.conf
langs=$(for l in po/documentation.*.po
do
rstripped=${l%%.po}
echo -n " ${rstripped##po/documentation.}"
done)
echo $langs >> po4a.conf
cat <<EOF >>po4a.conf
[po4a_paths] po/documentation.pot \$lang:po/documentation.\$lang.po
[options] opt: " -k 80"
EOF
for f in $(cat sources.txt)
do
echo -n "[type: asciidoc] en/$f \$lang:./\$lang/$f" >> po4a.conf
if [ ${f:0:3} = git ]
then
echo " add_\$lang:?addenda/addendum.\$lang.txt" >> po4a.conf
else
echo >> po4a.conf
fi
done
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment