Publisher does not support the Fluid field type. Please do not contact asking when support will be available.

If you purchased an add-on from expressionengine.com, be sure to visit boldminded.com/claim to add the license to your account here on boldminded.com.

Ticket: Language swtich link not working

Status Resolved
Add-on / Version Publisher 1.6.5
Severity
EE Version 2.10.1

Emmet Dunne

Nov 23, 2015

Description:
I’m using the {exp:publisher:languages} tag to output the language links, however, the link output by {switch_language_url} is refreshing the page and not loading the translated version.

Note: I’ve hardcoded the language options for the homepage, using these links I can access the pages in the translated version, however, the in-page language options dont work for me.

#1

BoldMinded (Brian)

Hi there. Please upgrade to the latest version of Publisher.

#2

BoldMinded (Brian)

This is a link to the latest build of 1.6.7 https://www.dropbox.com/s/u0lip2fgd2wn5oi/publisher-167-512eda83.zip?dl=0

#3

Emmet Dunne

Thanks for that, I’ve updated to 1.6.7 however the problem persists.

#4

BoldMinded (Brian)

You need to provide more info. What does the template look like? What are your publisher settings set to? Did you try it without your htaccess file? Can you share a link so I can see it? Did you read the text before submitting this ticket? Help me help you.

#5

BoldMinded (Brian)

This sounds like an environment specific issue because the switcher works fine, but I need a more descriptive steps to replicate and to see the site myself.

#6

BoldMinded (Brian)

Also I released 1.6.8 yesterday. Try that out.

#7

BoldMinded (Brian)

Are you using translated held? Structure or Pages or template_group/template based urls? When you provide steps to replicate please be descriptive about the URL, how it is generated, what segments are what (is it a template and entry URL title?)

#8

BoldMinded (Brian)

You had the “Force default language” setting turned on. Thats why the switcher wasn’t working 😊

#9

BoldMinded (Brian)

It looks like your navigation isn’t working b/c its possibly hard-coded without the language prefix. http://gaellinn.koobareview.com/en/learners works, http://gaellinn.koobareview.com/learners does not.

#10

Emmet Dunne

Hi Brian, sorry for not providing you with the info you required earlier. I’m using Structure for my urls. I had forced the default language as the site is to load in ‘Gaeilge’ and ‘English’ is the alternative language option, I guess I misunderstood this option in the settings, however, without the default forced I’m seeing ‘English’ when I load the site.

I’ve included the code for my navigation and languauge switch below. I’m hardcoding the navigation links based on a {publisher:current_language_code} conditional so that I should get the correct link based on the current language. The switcher is not putputting the language prefix currently so I’m getting a broken link for the language switcher.

Thanks, Christian

<header>
    <div class="wrapper">
  
        <!-- Navigation -->
        <nav>
            <ul>
             {if publisher:current_language_code=="en"}
                <li><a href="http://{root_url}en/irish">Irish</a></li>
                <li><a href="http://{root_url}en/learners">Learners</a></li>
                <li class="nav-logo"><a href="/">{root_url}img/logo.png</a></li>
                <li><a href="http://{root_url}en/teachers">Teachers</a></li>
                <li><a href="http://{root_url}en/contact">Contact</a></li>
                {if:else}
    <li><a href="http://{root_url}an-ghaeilge">An Ghaeilge</a></li>
                <li><a href="http://{root_url}dfhoghlaimeoiri">D’Fhoglaimeoirí</a></li>
                <li class="nav-logo"><a href="/">{root_url}img/logo.png</a></li>
                <li><a href="http://{root_url}do-mhuinteoiri">Do Mhúinteoirí</a></li>
                <li><a href="http://{root_url}teagmhail">Teagmháil</a></li>
    {/if}
            </ul>
        </nav>
  <!-- End Navigation --> 
  <!-- Language Switch -->
        <ul class="languages">
         {if segment_1 == '' && publisher:current_language_code!="en"}
             <li><a href="#">Gaeilge</a></li>
             <li><a href="http://{root_url}en">Bearla</a></li>
            {if:elseif segment_1 == '' && publisher:current_language_code=="en"}
             <li><a href="http://{root_url}">Irish</a></li>
             <li><a href="#">English</a></li>
            {if:else}
    {exp:publisher:languages}
    <li><a href="http://{switch_language_url}" class="language">{long_name}</a></li>
    {/exp:publisher:languages}
   {/if}
        </ul>
        <!-- End Language Switch -->     
    </div>
</header>
#11

BoldMinded (Brian)

It sounds like you have your default language set to English, or the get language from browser setting is on and your browser is set to English. Check those and clear your cookies or try a different browser.

Also please respond in the ticket. This info could be helpful to other customers but my inbox is not searchable 😊

#12

BoldMinded (Brian)

Oops, disregard that last line. It looked like you replied to the email when I first saw it.

#13

Emmet Dunne

Hi Brian, I’ve tested with cleared cookies and in another browser and its still behaving strangely. my default language is set to Gaeilge and the get language from browser setting is off.
When I load the site its showing in Gaeilge, when I switch to English it works, however, when I try to switch back it remains in English. Also, the {switch_language_url} is not outputting the language prefix ‘/en’ resulting in broken links Thanks

#14

BoldMinded (Brian)

It seems to be an issue when the “Add URL prefix to the homepage” setting is set to No, and “Hide the prefix for default language” is set to Yes. Can you confirm this is the case?

#15

Emmet Dunne

Thanks Brian, yes that’s right, I’ve tried changing these and the switcher links now work. I’ve a slight issue with the conditional below not picking up the ‘en’ language otherwise its all working

{if publisher:current_language_code=="en"}
        <a href="http://{root_url}en" class="logo"></a>
        {if:else}
        <a href="http://{root_url}" class="logo"></a>
        {/if}
#16

Emmet Dunne

Comment has been marked private.

#17

BoldMinded (Brian)

Emmet, I made a small change in Publisher on your site via FTP that appears to fix the issue. Can you please confirm its fixed?

#18

Emmet Dunne

Hi Brian, apologies for the late reply. I’m still seeing that the following conditional does not work.

{if publisher:current_language_code=="en"}
        <a href="http://{root_url}en" class="logo"></a>
        {if:else}
        <a href="http://{root_url}" class="logo"></a>
        {/if}

Can you let me know what changes you made. I’m also now seeing that my Structure listings are showing the default language regardless of the url

Thanks

#19

BoldMinded (Brian)

This is the change I made. https://www.dropbox.com/s/0w73bie9t25gw97/Screenshot 2015-12-01 06.38.28.png?dl=0

Did you put {publisher:current_language_code} in the template outside of a conditional to see what value it contains?

#20

Emmet Dunne

Hi Brian, the {publisher:current_language_code} tag is outputting correctly. The link you provided is not working for me Thanks, Christian

#21

Emmet Dunne

Comment has been marked private.

#22

BoldMinded (Brian)

Copy and past the entire link, the spaces cause it to not get formatted correctly. From what I can tell the language switching is working fine. Is there another case in which it is not that I’m not seeing?

#23

Emmet Dunne

Comment has been marked private.

#24

BoldMinded (Brian)

So you’re using Structure? Please provide detailed steps to replicate the issue. Also, please simplify… remove everything from the template except for the entries tag needed to render the text and replicate the issue. This may include creating a new template, Structure page and/or listings channel. Paste the template code in the ticket.

#25

BoldMinded (Brian)

Also what page in the Structure navigation is not working? Its not in English, so I can’t tell what is going on. I just need more direction and details, screenshots etc

#26

BoldMinded (Brian)

Comment has been marked private.

#27

Emmet Dunne

Comment has been marked private.

#28

BoldMinded (Brian)

Your breadcrumbs aren’t working b/c you haven’t added the right parameter to it. https://boldminded.com/add-ons/publisher/third-party-add-ons/structure

Please try this build: https://www.dropbox.com/s/pw13ax9waai42ej/publisher-169-8561846e.zip?dl=0

#29

Emmet Dunne

Hi Brian, thanks for your msg, the breadcrumbs update helped and the pusblisher update is now allowing for the translated listings to be displayed, however, some of my urls are now broken as a results. These are urls using freebie to exclude certain url segments. I’ll link you to these in a priveate msg, Thanks again 😊

#30

Emmet Dunne

Comment has been marked private.

#31

BoldMinded (Brian)

I can’t support whatever Freebie is doing. If you disable Freebie and the URLs still don’t work I can look into it, but if it only doesn’t work when Freebie is enabled then that isn’t a Publisher issue.

#32

Emmet Dunne

Comment has been marked private.

#33

BoldMinded (Brian)

Take a look at it now. I made a small change. I’ll need to test the change locally to make sure it doesn’t have any adverse side effects.

#34

Emmet Dunne

Hi Brian, thats working much better thanks, the broken links are now working well. I’m still seeing the /en/ version forced at sometimes, however, its working much better than previously Thanks

#35

Emmet Dunne

Comment has been marked private.

#36

BoldMinded (Brian)

Can you provide examples of the /en forcing? What actions are taken when that happens? Have you tried other browsers? Did you add any custom Publisher override config values to your config.php?

You’re welcome. Thank you for being patient too. I’ve made some changes to the URL stuff lately b/c of other weird edge cases that have popped up and it appeared to have created a new edge case 😛

#37

Emmet Dunne

Comment has been marked private.

#38

Emmet Dunne

Hi Brian, that’s working perfectly thanks a lot! 😊

#39

BoldMinded (Brian)

I’m confused, is it working fine or is it not? You said something about internal pages in comment #37 not working then in comment #38 you said it was.

#40

Emmet Dunne

Hi Brian, sorry for the confusion, its working fine now, Thanks a lot

Login to reply