• The site’s default language is Finnish.
    User chooses the language to English.
    User chooses link from menu. Page will open correctly in English.
    Page contains a link to more information. The page behind the link will open again in Finnish.

    It seems to me that this is a problem ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Alex Gor

    (@alexgff)

    What is your site URL ?

    Thread Starter maijapiippo

    (@maijapiippo)

    Sorry, I forgot it
    elamysvirta.fi

    Plugin Contributor Alex Gor

    (@alexgff)

    Next question
    What URL I must open to check your issue ?

    Thread Starter maijapiippo

    (@maijapiippo)

    That same.
    Go to https://www.elamysvirta.fi. select language (English), choose “services” and “fishing” for example. Then you can try “Muonionjoki” hyperlink… and You are in Finnish site again

    Plugin Contributor Alex Gor

    (@alexgff)

    You need to localize link in your theme and to get it in current language.
    For example if you have code

    
    <?php
    $url = 'https://www.elamysvirta.fi/palvelut/kalastus/muonionjoki/';
    ?>
    <h3><a href="<?php echo $url; ?>"><strong>Muonionjoki</strong> </a>&nbsp;<strong>&nbsp;river</strong>&nbsp; &nbsp; &nbsp;&nbsp;<a href="https://www.youtube.com/watch?v=35czHk7NvUc&t=27s" target="_blank">Video “Released salmon”</a></h3>
    

    then you need to replace first string to

    
    <?php
    $url = WPGlobus_Utils::localize_url('https://www.elamysvirta.fi/palvelut/kalastus/muonionjoki/');
    ?>
    
    • This reply was modified 8 years, 1 month ago by Alex Gor.
    Thread Starter maijapiippo

    (@maijapiippo)

    That fixes only one link? I am looking for universal solution. This is really arduous solution, because there are a lot of links

    • This reply was modified 8 years, 1 month ago by maijapiippo.

    @maijapiippo

    There is no code in WPGlobus that automatically translates links in the post content.

    You should change the links so that when you are on the page
    https://www.elamysvirta.fi/gb/palvelut/kalastus/

    then you put the link as
    https://www.elamysvirta.fi/gb/palvelut/kalastus/muonionjoki/

    (with /gb/ and without any PHP code)

    A relative link muonionjoki/ should work, too.

    Now, if you want to have all links in the body localized automatically, you can add a the_content filter and use the code similar to what Alex wrote. I wouldn’t do it and simply would write the correct links for each language.

    P.S. Lovely fish!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘The page behind the hyperlink will open in default language.’ is closed to new replies.