From 89b5f320d3a6f1096621fd4f4507910aaf4e9ff6 Mon Sep 17 00:00:00 2001 From: Brian (bex) Exelbierd Date: Dec 15 2017 08:43:33 +0000 Subject: Initial localization scripts --- diff --git a/.gitignore b/.gitignore index fa62c5c..94d5697 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ diag-*.png.cache ## Project-specific ignores _l10n/pot/ +_l10n/po/ diff --git a/_l10n/make_pot.sh b/_l10n/make_pot.sh index b376651..2c44757 100755 --- a/_l10n/make_pot.sh +++ b/_l10n/make_pot.sh @@ -7,15 +7,17 @@ for file in $( find -L $dir -name "*.adoc" ); do dirname=`dirname $file` path=`echo ${dirname#$dir/}` if [ "$dirname" = "$dir" ]; then - potname=$basename.po + potname=$basename.pot else potname=$path/$basename.pot mkdir -p pot/$path fi - echo po4a-gettextize -f asciidoc -m $file -p pot/$potname --master-charset "UTF-8" - po4a-gettextize -f asciidoc -m $file -p pot/$potname --master-charset "UTF-8" -o debug split_attributelist + echo po4a-gettextize -f asciidoc -m $file -p pot/$potname --master-charset "UTF-8" -o debug split_attributelist + PERLLIB=~/Repositories/Fedora-Docs/po4a/lib po4a-gettextize -f asciidoc -m $file -p pot/$potname --master-charset "UTF-8" -o debug split_attributelist done -# Needs a yml reader for po4a first -#echo po4a-gettextize -f asciidoc -m ../_topic_map.yml -p pot/_topic_map.yml.pot --master-charset "UTF-8" -#po4a-gettextize -f asciidoc -m ../_topic_map.yml -p pot/_topic_map.yml.pot --master-charset "UTF-8" +echo po4a-gettextize -f yaml -o keys=Name -m ../_topic_map.yml -p pot/_topic_map.yml.pot --master-charset "UTF-8" +PERLLIB=~/Repositories/Fedora-Docs/po4a/lib po4a-gettextize -f yaml -o keys=Name -m ../_topic_map.yml -p pot/_topic_map.yml.pot --master-charset "UTF-8" + +echo po4a-gettextize -f yaml -o keys="Name site_name" -m ../_distro_map.yml -p pot/_distro_map.yml.pot --master-charset "UTF-8" +PERLLIB=~/Repositories/Fedora-Docs/po4a/lib po4a-gettextize -f yaml -o keys="Name site_name" -m ../_distro_map.yml -p pot/_distro_map.yml.pot --master-charset "UTF-8" diff --git a/_l10n/pot/.gitkeep b/_l10n/pot/.gitkeep deleted file mode 100644 index e69de29..0000000 --- a/_l10n/pot/.gitkeep +++ /dev/null diff --git a/_l10n/use_pot.sh b/_l10n/use_pot.sh new file mode 100755 index 0000000..9a32dbc --- /dev/null +++ b/_l10n/use_pot.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +lang=$1 +dir="../en-US" # no trailing slash + +for file in $( find -L $dir -name "*.adoc" ); do + basename=`basename -s .adoc $file` + dirname=`dirname $file` + path=`echo ${dirname#$dir/}` + if [ "$dirname" = "$dir" ]; then + potname=$basename + else + potname=$path/$basename + fi + if [ -e po/$potname.$lang.po ]; then + echo po4a-translate -f asciidoc -m $file -p po/$potname.$lang.po --master-charset "UTF-8" --localized-charset "UTF-8" -l $file -o debug split_attributelist -k 0 + PERLLIB=~/Repositories/Fedora-Docs/po4a/lib po4a-translate -f asciidoc -m $file -p po/$potname.$lang.po --master-charset "UTF-8" --localized-charset "UTF-8" -l $file -o debug split_attributelist -k 0 + fi +done + +if [ -e po/_topic_map.yml.$lang.po ]; then + echo po4a-translate -f yaml -o keys=Name -m ../_topic_map.yml -p po/_topic_map.yml.$lang.po --master-charset "UTF-8" --localized-charset "UTF-8" -l ../_topic_map.yml -k 0 + PERLLIB=~/Repositories/Fedora-Docs/po4a/lib po4a-translate -f yaml -o keys=Name -m ../_topic_map.yml -p po/_topic_map.yml.$lang.po --master-charset "UTF-8" --localized-charset "UTF-8" -l ../_topic_map.yml -k 0 +fi + +if [ -e po/_distro_map.yml.$lang.po ]; then + echo po4a-translate -f yaml -o keys="Name site_name" -m ../_distro_map.yml -p po/_distro_map.yml.$lang.po --master-charset "UTF-8" --localized-charset "UTF-8" -l ../_distro_map.yml -k 0 + PERLLIB=~/Repositories/Fedora-Docs/po4a/lib po4a-translate -f yaml -o keys="Name site_name" -m ../_distro_map.yml -p po/_distro_map.yml.$lang.po --master-charset "UTF-8" --localized-charset "UTF-8" -l ../_distro_map.yml -k 0 +fi diff --git a/zanata.xml b/zanata.xml index d935d31..088fd42 100644 --- a/zanata.xml +++ b/zanata.xml @@ -1,15 +1,12 @@ https://fedora.zanata.org/ - install-guide-reboot + docs-install-guide master gettext _l10n/pot/ ./_l10n/po/ - {filename}.{locale}.po + {path}/{filename}.{locale}.po - - fr -