dash-docs/_contrib/translate
Saivann 21441d310d Handle urls translations automatically in pages
Internal page urls are now all declared once in _config.yml for each language
Translators can translate file and anchor urls without needing to manually update all pages
2013-04-25 18:32:51 -04:00

17 lines
636 B
Bash
Executable file

#!/bin/bash
if [[ -z ${1} || -z ${2} ]]; then
echo 'You must provide language code and language name. Ex : ./_contrib/translate fr "Français"'
exit
fi
cp -R en ${1}
cp _layouts/base-en.html _layouts/base-${1}.html
sed -i "s_layout: base-en_layout: base-${1}_g" ${1}/*.html
sed -i "s_lang: en_lang: ${1}_g" ${1}/*.html
sed -i "s_lang: en_lang: ${1}_g" _layouts/base-${1}.html
sed -i "s/ALERT_CLASS_en/ALERT_CLASS_${1}/g" _layouts/base-${1}.html
sed -i "s/ALERT_en/ALERT_${1}/g" _layouts/base-${1}.html
sed -i "/${1}: ${2}/d" _config.yml
sed -i "/langs:/a - ${1}: ${2}" _config.yml
sed -i "s_- ${1}: ${2}_ ${1}: ${2}_g" _config.yml