1

I use Transcribe's {exp:transcribe:language_links} tag in an embedded header template to output a language switcher.

The website has two languages and uses Structure to manage pages.

When I'm on a certain static page, that has been associated with language A, and does have a 'sister'-page in language B, and I use the language switcher, it always redirects me to the homepage, instead of the same page in language B.

Is this intended behaviour? Shouldn't I be redirected to the same page in the other language?

Also; I'm pretty sure it used to work at some point before the website went live. Could it have anything to do with the website being accessed from a different URL than during development?

1 Answer 1

2

You could have pasted your complete tag as an example :), however I guess you're doing sometihng like this (from the docs) :

{exp:transcribe:language_links}
    {languages}
        <a href="{link}"{if current} class="active"{/if}>{name}</a>
    {/languages}
{/exp:transcribe:language_links}

Right? I'm not sure if this is the desired beghaviour (I dobn't have transcribe installed) but couldn't you modify it to be somethnig like this (also from the docs):

<form action="{exp:transcribe:action_url}" method="post">
    <input type="hidden" name="XID" value="{XID_HASH}">
    <input type="hidden" name="RET" value="{current_path}">
{exp:transcribe:language_links}
    <select name="lang">
        {languages}
            <option value="{abbreviation}"{if current} selected="selected"{/if}>{name}</option>
        {/languages}
    </select>
{/exp:transcribe:language_links}

<input type="submit" name="submit" value="Submit" />

Here we are making a form that posts tothe language changing ACTion, but additionally I have added a hidden RET (return) parameter. If this form is handled like any other EE form this should dictate where to return the user after the ACTion.

As a bonus, you could also use transcribe to check if there is a translated entry for the current page, if there is set the RET value, if there isn't don't set it so they get sent ot the homepage...

Regarding the "it used to work", can you check that your channel entries have their linked language content still set? this should jsut be an entry relationship so no URL's stored, however it does seem like transcribe has 'lost track' of its Associated Entries. You didn't import any data did you?

Also, take a gander at the answers to this question : Transcribe - After AJAX request, when i switch language it directs me to the AJAX endpoint , while it's not directly related the solution describes how tracker is used to determin the last URL visited, perhaps the tracker is out of kilter??

2
  • Your answer works exactly. FYI latest version 2.2.2 resolved this issue Feb 28, 2017 at 11:50
  • 1
    Glad I could be of help Mufi, I thought this might be a dead thread so glad it proved useful! Thanks for confirming resolution version :)
    – Blatant
    Feb 28, 2017 at 11:53

Your Answer

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

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