Be sure to checkout our newest add-on Reading Time Pro!

Compatibility updates:

  • Publisher is EE5 compatible, but it does not currently support the Fluid field (it's in the works).

Ticket: Problem with {exp:publisher:languages} tag

Status Resolved
Add-on / Version Publisher 2.10.8 build e9838c43
Severity
EE Version 5.2.3

Gavin @ JCOGS

May 29, 2019

Hopefully a simple question.  Appears to be not unlike [this one](https://boldminded.com/support/ticket/343).

I have a site setup with two languages. 
Default language is Dutch.  Shortname=‘nl’ Language Name=‘NL’
Second langauge is English.  Shortname=‘en’ Language Name=‘EN’.

I created a simple language switching menu. 

The code used is this:

<ul class="menu">
                    {exp:publisher:languages}
                    <li><a href="{switch_language_url}">{long_name}</a></li>
                    {/exp:publisher:languages}
                </ul>

If I log into the site using the english url (i.e. https://somesite.com/en/...) the menu generated has this form:

<ul class="menu">
    <li><a href="https://somesite.com/?ACT=51&site_id=1&lang_id=1&url=aHR0cHM6Ly9wbHVxLmpjb2dzLm5ldC9lbi8=">English</a></li>
    <li><a href="https://somesite.com/?ACT=51&site_id=1&lang_id=2&url=aHR0cHM6Ly9wbHVxLmpjb2dzLm5ldC9lbi8=">Nederlands</a></li>
</ul>

In passing - I am not sure where the content for the substitution from the `{long_name}` variable has come from - assumed it would use the Language Name.  Is there a way to do this?

If I click on the “Nederlands” menu item the page reloads using the Dutch settings - however the language switching menu is changed: what I get now is

<ul class="menu">
    <li><a href="https://somesite.com/?ACT=51&site_id=1&lang_id=2&url=aHR0cHM6Ly9wbHVxLmpjb2dzLm5ldC9ubC8=">Nederlands</a>
</ul>

The English option has disappeared from the menu.

Why is this?  What do I need to do differently that means I have English option appear on both language settings?

(BTW, if I insert the {exp:publisher:switcher} tag on the page, both options appear on both pages - but there are no styling options for that tag, so need the languages version to work).

Hope this helps explain the issue, thanks in advance for whatever guidance is needed.

 

#1

BoldMinded (Brian)

May 29, 2019

Did you go to Phrases > Languages and add translations?

#2

Gavin @ JCOGS

May 29, 2019

Hi.  No.  The add-on was installed by a colleague - I’ve just had a look and the Phrases section contains four groups: Default and three random groups presumably added by my colleague.  The three random groups all have ‘delete’ icons next to their names, but the Default one does not.  I notice that according to the Phrases documentation there should also be a group called “Languages” but this is absent.  None of the groups have any content - again from look of documentation that’s where I would go to edit the titles being used for the languages in the dropdown, but no such group is visible.

Also does not explain the absence of English from the drop-down menu when viewing the NL language option - but maybe these two things are related.

Does this help explain things?  If I’m missing something please let me know and I will revert with info required asap.

Thanks for helping!

#3

BoldMinded (Brian)

May 29, 2019

Take a look at your db and see if the exp_publisher_phrase_groups table has a row with the ID of 2 for languages: https://d.pr/i/I5jms3

and check the exp_publisher_phrases table to see if there are phrases that belong to group_id 2: https://d.pr/i/66wKt1

If those don’t exist, you may need to create them manually. I don’t know why this would be happening, as I can’t replicate it.

#4

Gavin @ JCOGS

May 29, 2019

Ace - checked the table and there was a row with ID=2, but for unknown reasons the “site_id” value was set to “NULL” rather than “1”.  Changed the value to “1” and now the Languages group appears in the Phrases section.

However I still only get one language showing when I am viewing the site using the English variant (but get two when viewing using Dutch).  In the Phrases Section, the entry in the Language group for English only offers a single translation option (for English), but the Dutch entry has space for two entries (one for English, One for Dutch).  Could this be related to why the menu is only showing one entry when using the Dutch variant? 

I cannot see any mechanism for adding a row to the entry to give it two languages.  If I add a new language entry to the group that too only gets one language option.

#5

BoldMinded (Brian)

May 29, 2019

Can you share an sql dump of all the exp_publisher_phrase tables?

#6

Gavin @ JCOGS

May 29, 2019

Comment has been marked private.

#7

BoldMinded (Brian)

May 29, 2019

Are you able to provide CP login so I can take a look? If so edit the ticket and add the credentials in the provided fields.

#8

Gavin @ JCOGS

May 29, 2019

Comment has been marked private.

#9

BoldMinded (Brian)

May 30, 2019

I think if you run these queries it may fix the issue. If it doesn’t, then drop those tables and use that .sql dump you sent me to re-create them to start the debugging process again.

delete from exp_publisher_phrases where id = 2;
delete from exp_publisher_phrase_data where phrase_id = 2;
INSERT INTO `exp_publisher_phrase_data` (`phrase_id`, `site_id`, `lang_id`, `status`, `edit_date`, `edit_by`, `is_auto`, `phrase_value`)
VALUES
 (1, 1, 2, 'open', 1559157740, 1, 0, 'ENG (NL)');
#10

Gavin @ JCOGS

May 30, 2019

That worked.  Thanks!

#11

BoldMinded (Brian)

May 30, 2019

Sweet! So, which table had a null value for site_id? I want to check the install code to make sure it’s inserting the ID.

#12

Gavin @ JCOGS

May 30, 2019

The table was `exp_publisher_phrase_groups` (as you suggested in your post about this).  The site_id entry was NULL for the id=2 / languages entry.

HTH

#13

BoldMinded (Brian)

May 30, 2019

Thanks, I think I got it fixed for future installs.

Login to reply

Contact

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