Jump to content

Different images according to languages


celinem01
 Share

Recommended Posts

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:

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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