0

I have a issue with my language switcher when i'm in a entry page.

In this page, i rewrite the last-segment url witch is my product name with this script :

    <?php
    $outvar = "";
    $langvar = "{transcribe:language_abbreviation}";

    if ($langvar == "fr") {
    $outvar = $outvar . 'search:url-title-fr="{transcribe:last_segment}" ';
    }

    if ($langvar == "nl") {
    $outvar = $outvar . 'search:url-title-nl="{transcribe:last_segment}" ';
    }
    ?>

    {exp:channel:entries channel="products" <?php echo $outvar ?>}

The url become this :

FR : /fr/detail/MYPRODUCTNAMEINFRENCH
NL : /nl/detail/MYPRODUCTNAMEINDUTCH

Suppose my website is in French, when i click on my language switch (to show dutch version) i made with transcribe, i have :

/nl/detail/MYPRODUCTNAMEINFRENCH

the last segment stay in French.

Can you help to change this last segment when i switch language ?

Thanks

Jérôme

2 Answers 2

0

I think you're going about it in the wrong way. If you have an entry for the french language, you should relate that entry to a new/existing entry under the transcribe tab. The default transcribe language switcher will show the correct entry if the relationship was made. If you haven't made the relationship it will default to the homepage. there should be no need for php

2
  • Thank you for your answer. The problem is i don't want to duplicate all my channel fields because i have common custom fields for both languages. For example, i have a custom field for the product number and the code is the same for all languages. So i don't think transcribe is really useful in my case except for page and variable translation. But my client want two different url depend of languages for one product ans that's all the problem :-) thanks.
    – jca0310
    Commented Sep 3, 2015 at 11:53
  • but you don't need different sets of custom fields. all products, regardless of their language can reside in one and the same channel. Transcribe will only show th entries from the selected language Commented Sep 3, 2015 at 12:34
0

Thank you for your answer.

The problem is i don't want to duplicate all my channel fields because i have common custom fields for both languages. For example, i have a custom field for the product number and the code is the same for all languages. So i don't think transcribe is really useful in my case except for page and variable translation. But my client want two different url depend of languages for one product ans that's all the problem :-)

thanks.

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.