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: {publisher:segment_1} not translated and problem with route feature

Status Resolved
Add-on / Version Publisher 1.6.3
Severity
EE Version EE v2.10.1 - Build Date: 20150501

Barbara Cinotti

May 14, 2015

Hi Brian,

I’ve tried to use the templates translations and the routes features.

Detailed steps to reproduce the issue:
1. I have 1 channel: news-events in a site with 2 languages (italian default language and english)
2. I have a Template Group: news-eventi
3. Inside the “news-eventi” template group I have 2 Templates file: index for listing entries and view for the detail page.
4. I set up the Template Translations in Publisher Settings in this way: Template -> news-eventi——-> English: news-events
5. Switching from language to another works fine… For the listing enties (index) I have /it/news-eventi and /en/news-events
6. To link to my detail page I’m using:

<a href="{title_permalink='{segment_1}/view'}">{phrase:text_more}</a>

and it’s works
7. If I use

<a href="{title_permalink='{publisher:segment_1}/view'}">{phrase:text_more}</a>

it doesn’t work ...doesn’t give me the translated segment. Is this correct? Should {publisher:segment_1} give me the translated segment?
8. Try to use the route feature to remove the “view” from the url.
9. Setting in Template Route Manager:—> news-eventi—> view—> /news-eventi/{news:alpha_dash}
10. Setting in Publisher Route setting:—> news-eventi—> view—> /news-events/{news:alpha_dash}
11. If I use

<a href="{route='{segment_1}/view' news='{url_title}'}">{phrase:text_more}</a>

it renders in different ways:
in italian (default lang) is correct gives me the right url to the news (without view segment): news-eventi/im-a-test-news
in english it renders in a weird way:

<a href="{route='news-events/view' news='im-a-test-news'}">more</a>

my code

{exp:channel:entries channel="news-events" dynamic="no" publisher_enable_persistence="no" }
 <h1>{title}</h1>
<p> {body}<br /></p><p><a href="{title_permalink='{segment_1}/view'}">{phrase:text_more}</a></p>
<p> {/exp:channel:entries}

Maybe I miss something….

Any help is appreciated

thanks

Barbara

 

 

 

#1

BoldMinded (Brian)

{publisher:segment_1} provides the original, untranslated segments. If you want translated you just use the normal {segment_1} variable.

#2

Barbara Cinotti

Thanks Brian,

so for the route to remove the view template name, i have

{exp:channel:entries channel="news-events" dynamic="no" publisher_enable_persistence="no" }
 <h3><a href="http://{route=%27{segment_1}/view">{title}</a></h3>
{/exp:channel:entries}

that in italian default language render in the correct way

<a href="http://www.mysite/it/news-eventi/im-a-news">im a news it</a>

but in english is wrong

<a href="http://{route=%27news-events/view">im a news eng</a>

It seems that in english it doesn’t parse it.

Thanks

Barbara

#3

BoldMinded (Brian)

What happens if you just hard-code the route tag? {route=’news-events/view’ news=’im-a-news’} instead of using {segment_1} in it?

#4

Barbara Cinotti

I’ve hard coded either the segment_1 either the url_title

en
<h3><a href="http://{route=%27news-events/view">{title}</a></h3>
it
<h3><a href="http://{route=%27news-eventi/view">{title}</a></h3>

in italian is correct, im english still remains wrong

<h3><a href="http://{route=%27news-events/view">im a news eng</a></h3>
#5

BoldMinded (Brian)

So its just flat out not parsing the {route=”“} tag and rendering the unparsed tag to HTML in the non-default language.

#6

BoldMinded (Brian)

I’ll be able to dig into this more this weekend or early next week. Won’t have a solution today, sorry.

#7

Barbara Cinotti

Don’t worry Brian!

Take your time 😊

I’m still in development and I’m sending you all the “weird” things I found.

I’m using also a clean installation with only Publisher so I can exclude that other plugin can interfer be the culprit.

Have a nice week end

Barbara

#8

BoldMinded (Brian)

Comment has been marked private.

#9

Barbara Cinotti

Comment has been marked private.

#10

BoldMinded (Brian)

Are you sure the hard-coded second route is correct? E.g. it is set to a valid group/template? I did some testing locally and before I even started working on the translation part I had issues getting the routes to work, then I realized I had spelled my template group name wrong.

#11

Barbara Cinotti

Hi Brian, I think that the second route is correct, but probably there is something that I’m missing….

Description of my steps:

1) clean local installation with EE v2.10.1 - Build Date: 20150501 and Publisher 1.6.4 only - Publisher settings default except Enable URL translations? Yes - Add URL prefix? YES - Add URL prefix to the homepage? YES 2) setup 2 langs: EN (default) and IT. 3) create a template group –> events 4) inside events, create 2 template –> index (for entries listing) and view (for detail page) 5) create a channel –> events (just a title and a body field). 6) go to translate the template group (publisher - template translations) and beside events setting –> eventi (for italian translation) 7) my code for listing entries in index template inside events templates group that works fine (either in english than switching in italian)

{exp:channel:entries channel="events" dynamic="no" publisher_enable_persistence="no"}
 <h1><a href="http://{title_permalink={segment_1}/view}">{title}</a></h1>
{/exp:channel:entries}

one of the link is rendering :

<h1><a href="http://local.publisherdemo/index.php/en/events/view/event-1">Event 1</a></h1>
<h1><a href="http://local.publisherdemo/index.php/it/eventi/view/evento-1">Evento 1</a></h1>

8) now I want to remove the “view” template from the link. 9) go to EE template route manager and in group events - template view put –> /events/{news:alpha_dash} and setting required segment Yes 10) go to publisher - template translation and put –> /eventi/{news:alpha_dash} 11) change the url in the index template as follow

{exp:channel:entries channel="events" dynamic="no" publisher_enable_persistence="no"}
 <h1><a href="http://{route=%27events/view">{title}</a></h1>
{/exp:channel:entries}

and the links are render as follow:

<a href="http://local.publisherdemo/index.php/en/events/event-1">Event 1</a> for english, correct
<a href="http://local.publisherdemo/index.php/it/eventi/view">Evento 1</a> for italian. wrong

I’ve tried also hard coded the route and tried with different quotes (single, double) but the result is the same.

Thanks

Barbara

#12

BoldMinded (Brian)

I removed the Route column from the Template Translations settings page, I think I found a better way to do this without needing all that extra config. Its assuming, and I think this is the normal scenario, that all {route=”“} variables will be put in templates with the default group/template names, in which case I don’t think all the original route handling I created isn’t needed anymore. So, I’ve disabled the result of what those form fields do to see if the new build works as intended. Let me know how it goes.

#13

BoldMinded (Brian)

Comment has been marked private.

#14

BoldMinded (Brian)

Comment has been marked private.

#15

Barbara Cinotti

Comment has been marked private.

#16

BoldMinded (Brian)

Barbara, here is what I’m using to test:

route pattern: layouts/index/{name}/{apples}
<hr>
{exp:channel:entries channel="pages" limit="1"}
    {route="layouts/index" name="FooBar" apples="oranges"} 

    {route="layouts/index" name="Bazz"} 

    {route="layouts/{segment_3}"} 

    {route="layouts/detail/{url_title}"}
{/exp:channel:entries}
<hr>
{route="layouts/index" name="FooBar" apples="oranges"} 

{route="layouts/index" name="Bazz"} 

{route="layouts/{segment_3}"}

And the output:

route pattern: layouts/index/{name}/{apples}
http://ee290.dev/de/layouts-de/index-de/FooBar 
http://ee290.dev/de/layouts-de/index-de/Bazz 
http://ee290.dev/de/layouts-de/detail-de 
http://ee290.dev/de/layouts-de/detail-de
http://ee290.dev/de/layouts-de/index-de/FooBar 
http://ee290.dev/de/layouts-de/index-de/Bazz 
http://ee290.dev/de/layouts-de/detail-de

The url_title tag does not parse, even when Publisher is disabled. I’m guessing the route tag doesn’t natively have the context it needs to parse the url_title parameter value.

#17

BoldMinded (Brian)

Comment has been marked private.

#18

Barbara Cinotti

Comment has been marked private.

#19

BoldMinded (Brian)

Comment has been marked private.

#20

Barbara Cinotti

Comment has been marked private.

#21

BoldMinded (Brian)

Comment has been marked private.

#22

Barbara Cinotti

Comment has been marked private.

#23

BoldMinded (Brian)

Barbara, try un-installing and re-installing that extension.

I’m going to close this ticket as the main issue is resolved. I don’t want 2 separate issues in the same ticket. If the NavEE error is still an issue after un-installing and re-installing, then create a new ticket. Thanks.

Login to reply