change link in translation to match file name
This commit is contained in:
parent
a16178d86e
commit
14c26b8a23
2 changed files with 32 additions and 1 deletions
27
generate.sh
27
generate.sh
|
@ -113,7 +113,7 @@ fi
|
||||||
|
|
||||||
mkdir $target
|
mkdir $target
|
||||||
|
|
||||||
for l in $(ls $files)
|
for l in $(ls -d $files/*/ | cut -d\/ -f2)
|
||||||
do
|
do
|
||||||
generate_header lang/$l/header.link
|
generate_header lang/$l/header.link
|
||||||
echo "Create folder $l in $target..."
|
echo "Create folder $l in $target..."
|
||||||
|
@ -158,6 +158,31 @@ do
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
echo "Header links translation..."
|
||||||
|
mapfile translateHeader < lang/links.config
|
||||||
|
langs=${translateHeader[0]}
|
||||||
|
nbLang=$(echo "$langs" | grep -c "|")
|
||||||
|
for (( i=1; i<${#translateHeader[@]}; i++ ))
|
||||||
|
do
|
||||||
|
# pour chaque langue
|
||||||
|
for j in $(seq 0 $nbLang)
|
||||||
|
do
|
||||||
|
currentLang=$(echo ${translateHeader[0]} | cut -d\| -f$(( $j + 1 )) | tr -d " ")
|
||||||
|
currentFile=$(echo ${translateHeader[$i]} | cut -d\| -f$(( $j + 1 )) | tr -d " ")
|
||||||
|
|
||||||
|
# on doit modifier son lien de traduction
|
||||||
|
for k in $(seq 0 $nbLang)
|
||||||
|
do
|
||||||
|
[[ $k -eq $j ]] && continue
|
||||||
|
|
||||||
|
lang=$(echo ${translateHeader[0]} | cut -d\| -f$(( $k + 1 )) | tr -d " ")
|
||||||
|
file=$(echo ${translateHeader[$i]} | cut -d\| -f$(( $k + 1 )) | tr -d " ")
|
||||||
|
|
||||||
|
sed -i -e "s/href=\"\/$lang\/.*\.html/href=\"\/$lang\/$file.html/" www/$currentLang/$currentFile.html
|
||||||
|
done
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
echo "Copy $annexes in $target..."
|
echo "Copy $annexes in $target..."
|
||||||
cp -t $target -r $annexes
|
cp -t $target -r $annexes
|
||||||
|
|
||||||
|
|
6
lang/links.config
Normal file
6
lang/links.config
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
fr |en
|
||||||
|
apropos |about
|
||||||
|
autres |others
|
||||||
|
copaings|friends
|
||||||
|
ou |where
|
||||||
|
projets |projects
|
Loading…
Reference in a new issue