Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images on COVID-19 page are not translated #393

Open
rousik opened this issue May 5, 2020 · 4 comments
Open

Images on COVID-19 page are not translated #393

rousik opened this issue May 5, 2020 · 4 comments

Comments

@rousik
Copy link
Collaborator

rousik commented May 5, 2020

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.

@rousik
Copy link
Collaborator Author

rousik commented May 5, 2020

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?

@rousik
Copy link
Collaborator Author

rousik commented May 5, 2020

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.

@rousik
Copy link
Collaborator Author

rousik commented May 5, 2020

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.

@rousik
Copy link
Collaborator Author

rousik commented May 5, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant