Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best approach for localize images

What is the best approach in order to localize images (buttons and other content) in a i18n rails app?

like image 920
Irukandji Avatar asked Aug 10 '09 06:08

Irukandji


People also ask

Which technique is used for localization?

"he occlusal technique is a method used to examine large ai. s of the upper or lower jaw. exposed at different angles, can be used as a localization technique.

What does it mean to localize an image?

Image localization is the practice of adapting the images in your digital content for a new audience in a different location.


1 Answers

I usually inject the locale name in every path or in the image name. In the first case, create different folders for different locales

/public/images/en/file.png
/public/images/it/file.png

image_tag("#{I18n.locale}/file.png")

In the second case

/public/images/file.it.png
/public/images/file.en.png

image_tag("file.#{I18n.locale}.png")

I usually prefer the second solution because there are many assets I don't need to localize and I often need to keep translated/common assets in the same folders to take advantage of convenction-over-configuration pattern.

like image 124
Simone Carletti Avatar answered Sep 22 '22 00:09

Simone Carletti