Robert Zelník Posted April 22, 2012 Share Posted April 22, 2012 The field types File and Image have Description fields. These fields should also be translatable. Link to comment Share on other sites More sharing options...
ryan Posted April 23, 2012 Share Posted April 23, 2012 I have the same wish. But this is a little more complex than it sounds, so has to wait until there's time to do it right. However, shorter term the intention is that one can use an image field in a repeater to achieve something similar. 1 Link to comment Share on other sites More sharing options...
doolak Posted January 28, 2013 Share Posted January 28, 2013 Anything new about the multilanguage image description? As i try to avoid that the site editor has the possibility to insert images in a texarea field, it's just a minor problem. For the most cases i will use a repeater field as ryan described. Just would be great to know for a current development site if there will be such a release soon or if it will take some more time to have this supported. Link to comment Share on other sites More sharing options...
ryan Posted January 29, 2013 Share Posted January 29, 2013 This is not planned for 2.3. Inclusion in 2.4 or 2.5 is more likely. Link to comment Share on other sites More sharing options...
boblibob Posted March 30, 2013 Share Posted March 30, 2013 Greetings Everyone! Hope it's ok to post in an old thread. I need the image description translation very much. I was reading through the PHP internationalization page. In the last section it provides an example of how it is possible to translate dynamic strings... $title = __($title, '/wire/templates-admin/default.php'); to translate the same field in many languages(Thats what I understood, correct me if I am wrong). So I tried to do something like this... // site/templates/album.php <?php $album_title = $page->title; echo '<h1>'. __($album_title) .'</h1>'; $images = $page->images; foreach($images as $image){ $description = $image->description; $img_title = $image->name; echo '<div class="block"><a href="'. $image->url . '">'. '<img src="' . $image->width(190)->url . '" />'; echo '<h3>' . __($img_title) . '</h3>'.'<p>'; echo __($description); echo '</p></a></div>'; } and tried to add album.php to translate in admin > setup > language > ru (that should create the json file to store the translations in there...). But the admin panel says that "That file has no translatable phrases". I guess I misunderstood about passing a dynamic string to the __() function. So there goes the questions. 1. Is this possible to achieve? 2. Whats wrong with my approach? 3. What is the right way and right scenarios allow me to pass a dynamic string to the __() function? Please Help Link to comment Share on other sites More sharing options...
ryan Posted March 31, 2013 Share Posted March 31, 2013 You can only pass static strings to the __() function. At least, the translation parser will only be able to find static strings. The only reason you'd put a variable in a call to the __() function, is if you knew the text was already available translated, and wanted to retrieve the translated version. But that text would have had to appear statically, somewhere else in the file. To make a multi-langage image field, you can use a Repeater. Your repeater would contain two fields: 'image' and 'summary'. Make the 'image' field of type Image, and set to to contain max 1 image. Make the 'summary' field of type TextLanguage (or TextareaLanguage). The Image field is the next one on the list to make multi-language capable, so should be within the next major version of ProcessWire. 6 Link to comment Share on other sites More sharing options...
boblibob Posted April 1, 2013 Share Posted April 1, 2013 Thank you a lot Ryan. I get it now. I was aware about the repeater but I did not like the idea of uploading bunch of images one by one. If I am not wrong thats what's going to happen, however I did not try it yet. Anyway I will find out tomorrow, it seems that I don't have any other choice. Thank you for including this feature for the future updates. Sorry for bothering you with silly questions at first time. Link to comment Share on other sites More sharing options...
Arklogic Posted March 14, 2014 Share Posted March 14, 2014 You can only pass static strings to the __() function. At least, the translation parser will only be able to find static strings. The only reason you'd put a variable in a call to the __() function, is if you knew the text was already available translated, and wanted to retrieve the translated version. But that text would have had to appear statically, somewhere else in the file. To make a multi-langage image field, you can use a Repeater. Your repeater would contain two fields: 'image' and 'summary'. Make the 'image' field of type Image, and set to to contain max 1 image. Make the 'summary' field of type TextLanguage (or TextareaLanguage). The Image field is the next one on the list to make multi-language capable, so should be within the next major version of ProcessWire. Oh I've found the best thread for my problem, so I'm asking if you have plans to implement the image field translation thing to the next release? 1 Link to comment Share on other sites More sharing options...
kixe Posted March 17, 2014 Share Posted March 17, 2014 The Image field is the next one on the list to make multi-language capable, so should be within the next major version of ProcessWire. @ryan since I am quite happy with PW 2.4 I kindly ask if there is any progress for the multi-language-image-description-field? I tried to make it by myself but it goes too deep in the sourcecode so that I decided to keep my hands off. 1 Link to comment Share on other sites More sharing options...
ryan Posted May 23, 2014 Share Posted May 23, 2014 File and image fields now support multiple languages for the description (in the current PW dev branch). The multi-language capability was built directly in the existing file/image fields, so nothing needs to be installed/modified–they simply become multi-language when you've got language support active. Thanks to stardesign for sponsoring this addition. 16 Link to comment Share on other sites More sharing options...
justb3a Posted October 15, 2014 Share Posted October 15, 2014 If you need more than the description field to be translated, you can use the Module FieldtypeImageExtra. 2 Link to comment Share on other sites More sharing options...
blackeye1987 Posted October 20, 2014 Share Posted October 20, 2014 hey hope i am not too late.. is there any possibility that following error will be available for translation ? in wire\modules\inputfield\inputfieldfile\inputfieldfile.js $fileList.append(errorItem(files[i].name, extension + ' is a invalid file extension, please use one of: ' + extensions)); 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