EE compatibility updates:

  • Publisher is EE5 compatible, but it does not currently support the Fluid field.

ExpressionEngine.com licenses:

  • 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 Switcher not working when ‘Add URL Prefix, Add URL prefix to the homepage, & Hide the prefix for default language’ are enabled

Status Resolved
Add-on / Version Publisher 3.1.5 build e53a9050
Severity
EE Version 5.3.2

Hop Studios

Sep 28, 2020

Hey Brian,

I have another issue that I can’t seem to get past.

I’m wanting to use the following settings:
Add URL Prefix
Add URL prefix to the homepage
Hide the prefix for default language

We have 2 languages, and I only want the ‘fr’ to show in the url when it is the active language. Great that these settings are available to allow for this.

I’m having an issue, however, where the language switcher is not working when these settings are enabled.
I have tried:
a) just switching the URL to add /fr to the beginning if switching to french
b) using the included language switcher with style=“links”.

I have noticed that clicking on the link only does not change the language.
The cookie does value of exp_publisher_site_language doesn’t change when the page reloads. If I manually change the URL and add in or remove the ‘fr’ segment, it works.

This is puzzling to me. Am I missing a step? Do I need to manually check if the cookie is set and redirect to the ‘fr’ segment after the built in switcher link and Action are run?

My dynamic language switcher links look like this:
http://nccdh.localhost/?ACT=134&site_id=1&lang_id=1&url=aHR0cDovL25jY2RoLmxvY2FsaG9zdC9mci9hYm91dC10aGUtbmNjZGgvZW1wbG95bWVudC1vcHBvcnR1bml0aWVz

Please advise on how to get the switcher to work properly.

thank you!
Rowan
Hop Studios

#1

BoldMinded (Brian)

Sep 28, 2020

If you use {translated_url} instead of {switch_language_url} what happens?

#2

Hop Studios

Sep 28, 2020

Hey Brian,
These appear to have no effect.

I was using this FYI: {exp:publisher:switcher style=“links” show=“1”}

I did try the {exp:publisher:languages} tag pair also, and tried as you suggested with the two variables.

The language does not change with any of these options.

I also confirmed that the ‘force default language’ is not enabled.

Thanks
Rowan

#3

BoldMinded (Brian)

Sep 28, 2020

Does it work on sub pages and it’s just the home page where there are no segments that it is the problem?

#4

Hop Studios

Sep 28, 2020

Hey Brian,
Thanks for the help with this.
I made an error using the same ID on the anchor which was replacing the href with the old language switcher. I have removed this and now it is working.

Both of your suggestions work.

{exp:publisher:languages show="2"}
   <a href="http://{switch_language_url}">{long_name}</a>
   {/exp:publisher:languages}

the {translated_url} also works!

This didn’t work though:
{exp:publisher:switcher style=“links” show=“2”}

Thanks for your help.
Rowan

#5

BoldMinded (Brian)

Sep 29, 2020

In Service/Session.php, line ~892 you should see

if (!$urlFromGet) {

Change it to

if ($urlFromGet) {

And see if that fixes it.

Login to reply

For add-on support, please use the Support section. General inquries and pre-sale questions can be sent to support@boldminded.com.