Jump to content

Recommended Posts

Posted

Hello,

I have 2 languages in my website. I have translated all texts, it works well.

But I would like also translate some images. For example, I have 1 image in French and I would like another image in English. Is that possible ?

Thanks

Posted

Welcome to the forum celinem01.
Language alternate field values doesn't exist for fieldtype file (or image) but for Text Fields. Create a simple Textfield of type the textLanguage where you store the name of your language specific image. Name it for example 'langImage'.
In the template you can use it

<img src="/path/to/image/{$page->langImage}"/>

If you use the same images in different projects you can do it like this.
Put a translatable string in your template

$img_file_name = __('filename.png');
<img src="/path/to/image/$img_file_name"/>

Now you can create a translation for this template file. Description here:

Posted

Thanks for your reply.

I have a field which is named "image". So i should create another field "image_en" and in my php template, i should call $image->url (and not $image_en->url and it will automatically display the right language.

Is that right ? I am not sure to understand, for other text fields i have 2 tabs (french en english), but not for image.

Posted

For example, on my template file I have 3 images which are displayed with this code :

foreach($page->image as $image) {

          echo "<img src='{$image->url}' title='{$image->description}' />"

}

In admin area, I have a field "Image" with my 3 images.

What I need to do to add this images in the other language ? (there are some texts on theses images that I want to translate).

Thanks.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...