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: Get translated template value

Status Resolved
Add-on / Version Publisher 1.6.2
Severity
EE Version 2.9.2

Keiron Lowe

Mar 23, 2015

Hey I’m trying to get the translated template value but I’m struggling a bit. I want my urls to look like:

* /products/category_1/
* /products/category_2/
* /products/category_3/

I’m using this to generate it:

{path='/products/'}/{exp:publisher:translate_category cat_id="{cat_id}" return="cat_url_title"}/
. It works absolutely fine when viewing it in the default language, but when in another language it removes the ‘products’ part of the url rather than replace it with the translated value, so it becomes
fr/category_1, fr/category_2
. Seeing as the path variable is part of EE not publisher, it looks to be an issue with that, so is there any easier way to translated value. Maybe a template tag such as
{exp:publisher:translate_template}

?

#1

BoldMinded (Brian)

Keiron, you shouldn’t have to do anything like that for template translations. Just enter the translated value in the Template Translations section, and enter translations for each category’s url title. You can use

{path='products/category_1/category_2'} and it should translate both.
#2

Keiron Lowe

That seems to work for translating the category name, but it still removes the ‘products’ part of the URL when viewing in a different language.

{exp:channel:categories category_group="2" channel="products" show="14|82|83|79|81|80" show_empty="yes" style="linear" disable="category_fields"}
    {path="products/{category_url_title}"}
{/exp:channel:categories}

In english, it displays properly, so the URL’s are domain.com/products/category_name/, but if I change to French, then they become domain.com/category_name/.

#3

BoldMinded (Brian)

Keiron, I replicated this in my environment and the full path translates:

My full template

{embed="global/switcher"}

<h2>exp:channel:categories</h2>
{exp:channel:categories category_group="1" channel="pages" show_empty="yes" disable="category_fields"}
{path="pages/{category_url_title}"}
{/exp:channel:categories}

Template translations: https://www.dropbox.com/s/aijd4n6wtwldv05/Screenshot 2015-03-24 06.34.36.png?dl=0 Results: https://www.dropbox.com/s/qrtjls24q8yn676/Screenshot 2015-03-24 06.33.54.png?dl=0 https://www.dropbox.com/s/z5iofqgbm35lcts/Screenshot 2015-03-24 06.33.02.png?dl=0

Are you sure you entered translations for the products template group?

#4

Keiron Lowe

Hmm it looks like the it wasn’t using the english fallback for the template translations. So because the template translation for the products template was blank, thats why it wasn’t showing in the url. If I enter a translation for the template then it works.

#5

Keiron Lowe

Thanks for helping me figure out the issue anyway!

#6

BoldMinded (Brian)

No worries 😊

Login to reply