dash-docs/_contrib/translate
Saivann d1c90a6232 improve translation system
jekyll now automatically generates sitemap
alternate hreflang is now correctly handled by sitemaps
language bar now gracefully associate with the translated equivalent of the page
update README with updated translation guidelines and instructions
2013-03-25 00:01:18 -04:00

20 lines
815 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_href=\"/en/_href=\"/${1}/_g" ${1}/*.html
sed -i "s_src=\"/en/_src=\"/${1}/_g" ${1}/*.html
sed -i "s_href=\"/en/_href=\"/${1}/_g" _layouts/base-${1}.html
sed -i "s_src=\"/en/_src=\"/${1}/_g" _layouts/base-${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