-1
I have an HTML project that needs different images for each language.
The image is loaded into index.html with <img src="">
. How to change the image according to the chosen language?
I tried that code:
"img1": {
"pt": '../img/img-pt.jpg',
"en": '../img/img-en.jpg',
}
depends on how you developed the system, if it is only html, I would create a select with both languages, and then create a javascript function to read this select and define which image to use.
– Lodi
@Lodi is using only html and js, with n18i.js which has text translation properties, but I tried unsuccessfully to use the same logic, as I explained in the question.
– Marlon Andrade
I’ve never heard of this n18i, but taking everything into consideration, I believe that what you should do is build a javascript function to change the images, as the language changes! do with Jquery you take the element, and change the src attribute to the desired!
– Lodi