Open rousik opened 4 years ago
The problem seems to be due to image paths. Absolute paths /images/${stuff}.png
always point to the english version. If we use relative path such as images/${stuff}.png
, this will not be found as the translated images reside under /${lang}/images/${stuff}.png
. Relative to COVID-19 page this should be ../images/${stuff}.png
. Maybe there's a way to detect and fix these?
Ideally there would be a programmatic way to fix /images/ paths to the correct localized destination when the site is built. It is unclear if that is easily possible.
Alternatively we could "fix" this in the import_language.rb script by looking for ]((|/)images/*.svg)
and replacing it with ](/$lang/images/*.svg)
within files below _sections/COVID-19
.
I have used the following sequence for a temporary fix:
cd _sections/COVID-19
sed -i 's/(image/(\/image/' $(grep -r '(images' | grep -v en/))
grep '(/images' -r | grep -v en/ | \
while read f ; do l=$(echo $f|cut -f1 -d/) ; sed -i "s/(\/images/(\/$l\/images/" $f ; done
I have assumed that PNG pictures embedded on COVID-19 page used to have their labels translated. This is no longer case. I do not know why. We should try to fix that.