celinem01 Posted December 22, 2014 Share Posted December 22, 2014 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 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted December 22, 2014 Share Posted December 22, 2014 yep, language alternate field values 2 Link to comment Share on other sites More sharing options...
kixe Posted December 22, 2014 Share Posted December 22, 2014 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 More sharing options...
Soma Posted December 22, 2014 Share Posted December 22, 2014 Alternate language fields work just fine for files and images. 2 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted December 22, 2014 Share Posted December 22, 2014 Alternate language fields works for all fields. 1 Link to comment Share on other sites More sharing options...
kixe Posted December 22, 2014 Share Posted December 22, 2014 Always something to learn. Thanks. Link to comment Share on other sites More sharing options...
celinem01 Posted December 22, 2014 Author Share Posted December 22, 2014 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 More sharing options...
celinem01 Posted December 23, 2014 Author Share Posted December 23, 2014 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now