1

I'm using Transcribe to create multiple language sites and also using relationship fields on some of my channels.

The problem is that the relationship field on the publish screen shows all entries from the related channel, regardless of which language site it belongs too.

This isn't ideal as on the publish page there is no way to tell what language those entries belong too, and you could accidentally relate entries that belong to another language site.

Anyone any ideas on a solution to this?

Cheers Darren

1 Answer 1

2

We ran into the same issue with Transcribe and Playa fields. We had a 'staff' channel (amongst many others) so we had lots of identically named entries for each person in each language (4 x John Smiths, etc), so it was tricky trying to pick the correct language 'John Smith' in a Playa field.

First of all, the ideal solution would be if there was a Transcribe extension that had the option to automatically filter the Playa/Relationship entries by language, or else add a language column or label to these fields so you can easily choose the correct language entry. I think that's a feature request though.

In the meantime, Tom from EE Harbour suggested the following workaround to us:

Most people end up adding the language prefix to the title of the entry. From there, they create a "Display Title" field that they use in the template to actually display the title without the language prefix.

This is probably the simplest workround and the one that we'd recommend if we did this again. At the time though, we weren't keen on using the Title field in this way, and having to create a Display Title field. It seemed like extra work and extra copying and pasting for the client. It would have been the most simple solution for us to implement though.

So rather than use the above workaround, we created a 'Language' category group, and created a category for each language that's being used on the site. We then used the Category Field add-on to add a 'Language Helper' custom field (showing a single option category drop down) to each channel that appears in Playa fields:

Language Helper Dropdown Field

Then when the client is using a Playa field, they can use the category filters to filter the entries by language:

enter image description here

The client wasn't 100% happy with having to manually set this additional dropdown field for every entry, so we added the following JS to the control panel (adding it to the Custom Javascript field within the CP CSS & JS add-on) to make this field automatically populate itself based on the Transcribe Language Association dropdown (and we made sure our category names exactly matched the labels in this dropdown).

In the following code, field ID's 95-106 are all the 'Language Helper' custom fields we added to the various channels on the site, so you might not need so many if you have a smaller site).

$(window).on('load', function() {
  var transcribeModule = (function() {

    var $hold_field = $('#sub_hold_field_transcribe__transcribe_language').find('select');
    if(!$hold_field.length) {
      return false;
    }

    var $target_field = $('#hold_field_94.publish_category_field, #hold_field_95.publish_category_field, #hold_field_96.publish_category_field, #hold_field_97.publish_category_field, #hold_field_98.publish_category_field, #hold_field_99.publish_category_field, #hold_field_100.publish_category_field, #hold_field_101.publish_category_field, #hold_field_102.publish_category_field, #hold_field_103.publish_category_field, #hold_field_104.publish_category_field, #hold_field_105.publish_category_field, #hold_field_106.publish_category_field').find('select.category_field_select');

    if(!$target_field.length) {
      return false;
    }

    function mirrorFields() {
      var selected_text = $hold_field.find(':selected').text();
      $target_field.find('option').each(function() {
        var $this = $(this);
        $this.removeAttr('selected');
        if($this.text() == selected_text) {
          $this.attr('selected', true);
        }
      });
    }

    mirrorFields();

    $hold_field.on('change', function() {
      mirrorFields();
    });
  }());
});

So all in all, there's no ideal solution that we know of here, but hopefully, one these two workaround are of use to you.

2
  • Thanks for the suggestions. I'm not keen on adding Language specify info to every entry title. I think the client will not be consistent with this in a real world situation. Also it doesn't really help when there are lots of entries as it means scrolling through lots of entries.
    – Readio
    Commented Dec 16, 2014 at 0:58
  • If you come across any better solutions than the two I've described above, please let me know as I'm all ears.
    – Stephen
    Commented Dec 16, 2014 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.