Juergen Posted May 14, 2015 Share Posted May 14, 2015 It would be great to add a copy button for content fields on multilingual site. F.e.: You have written a complex text with images, tables and so on in your body field in your default language (fe English). After that you want to translate the content to other languages (German, French). Therefore you have copy all the content. If there will be a copy button to copy the whole content of the default language body field to all the other language body fields with only one click. You will only have to translate the content. There will be no need to insert all the elements once more by copy and paste. This would be a great addition to make working with multilingual sites much more comfortable. Best regards 2 Link to comment Share on other sites More sharing options...
horst Posted May 14, 2015 Share Posted May 14, 2015 And what's about the risc, that when once finished translating a huge text to 12 languages, hitting that button by accident? 1 Link to comment Share on other sites More sharing options...
tpr Posted May 14, 2015 Share Posted May 14, 2015 With great power comes great responsivity Perhaps the risk could be minified adding some kind of confirmation, or requiring a checkbox to overwrite existing content. 1 Link to comment Share on other sites More sharing options...
Martijn Geerts Posted May 14, 2015 Share Posted May 14, 2015 Copy sourcecode & paste ? 1 Link to comment Share on other sites More sharing options...
Juergen Posted May 15, 2015 Author Share Posted May 15, 2015 Copying the source code is necessary at the moment. Anyway. It could be a useful feature to copy content via clicking a button and maybe it could be integrated easily without a lot of effort. But this is not a real important feature. It was only a thought of mine to improve the workflow. Best regards Link to comment Share on other sites More sharing options...
tpr Posted May 15, 2015 Share Posted May 15, 2015 I think it could be easily done with JavaScript (module). At least until the "body" field is the only target. Link to comment Share on other sites More sharing options...
Juergen Posted May 15, 2015 Author Share Posted May 15, 2015 My goal was not to copy only one field. The body field was only an example. It would be great to copy all multilingual fields in the template with only one click. Imagine you have more textareas or editor fields in a template. One click and you have copied all your fields at once. Link to comment Share on other sites More sharing options...
tpr Posted May 15, 2015 Share Posted May 15, 2015 This complicates things a lot. Imagine that autocomplete fields, field dependencies, images etc would need to be taken into account. Link to comment Share on other sites More sharing options...
inlupus Posted July 20, 2015 Share Posted July 20, 2015 I wrote a short script which searches all language fields and call an update statement to copy the content to another language <?php include(__DIR__."/index.php"); $field_db_names = array(); foreach($wire->wire('fields')->find("type=FieldtypeTextareaLanguage|FieldtypeTextLanguage") as $key => $field) { $field_db_names[] = strtolower($field->name); } $languageMap = array( 'data' => 'data1017' ); $db = $wire->wire('database'); foreach ($field_db_names as $field) { echo "processing field ".$field."\n"; foreach ($languageMap as $from => $to) { echo "copy $from to $to \n"; $sql = sprintf("UPDATE field_%s SET %s = %s WHERE %s = '';",$field,$to,$from,$to); $db->query($sql); } } $languageMap contains the information what field is used to fetch the content. so in this example data is copied to data1017 if it is still empty (so nothing is overwritten). 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