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: Is it possible to find out find out if a channel entry has a translation for a specific language?

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

Gavin Lawrie

Mar 27, 2015

I’m replacing a multi-lingual system that was built with multiple / duplicated pages for translations filtered using if-then statements based on status codes (e.g. “open”, ‘open_fr”, “open_ar” etc.).

For example, In one part of the site the existing design displays sets of channel entries based on their status codes - so a bunch of French pages, a bunch of English pages etc.

Replacing this with Publisher results in having only one channel entry per item, which can thus only have one status code.  So I’m trying to work out if I can replicate the filtering of the original site with Publisher in place. 

I would be grateful for any advice about how to do this. 

Is there a way to filter items from a channel based on whether the items have translations for a specific language?

I could not see any tags that would do this, but I’m maybe missing something, or there is a way to do this via some other technique.

Anyhow, grateful for any / all suggestions.

#1

BoldMinded (Brian)

Hi Gavin. yes, you can do this. Take a look at the documentation. What you’re looking for is the Additional {exp:channel:entries} Parameters section.

https://boldminded.com/add-ons/publisher/template-tags

#2

Gavin Lawrie

Great - helpful.

I am not entirely sure how I use this information to achieve what I want. So just to check, if we have three languages in our system right now (English [Publisher code 1], French [2], Arabic [3]).

To pull a set of items from a channel that have translations into French I would need something like this?

{exp:channel:entries channel="person" publisher_fields="publisher:"}
{if publisher:publisher_lang_id == "2"} ... do something ...{/if}

Also, does this feature play nicely with item selection using exp:channel:categories? Also, does this feature play nicely with exp:low_reorder:entries?

Thanks alot for your help.

#3

BoldMinded (Brian)

Oh, I see what you’re saying. If you’re on the English site, e.g. the cookie and session are set to English, but you want to show French content somewhere, then just add publisher_lang_id to the entries tag:

{exp:channel:entries channel="person" publisher_lang_id="2"}

This will show only French translations for the entries.

#4

BoldMinded (Brian)

Both should play fine with categories and low reorder.

#5

Gavin Lawrie

Ahah. OK - that’s a lot easier than I thought, though it appears not to go well with low_reorder.

The filter I am trying to change is based on status flags, and looks like this:

{exp:low_reorder:entries set="1" category="{category_id}" status="open_ar"}

This returns just the members of category that have the open_ar status flag.

If I replace the status switch with publisher_lang_id= like this:

{exp:low_reorder:entries set="1" category="{category_id}" publisher_lang_id="3"}

I get the whole of the category returned (i.e. no filtering based on publisher_lang_id=

Am I doing something silly? Or is it simply not playing nicely with low_reorder?

Also, is use of publisher_lang_id for filtering documented somewhere? It only seems to appear in tag documentation in passing as a way of forcing a form to load in a specific language. But would be a useful addition to the tag documentation I think, if it is not written about anywhere else.

Thanks again for your very helpful help.

#6

BoldMinded (Brian)

It sounds like Publisher won’t work with Low Reorder if you’re querying by language like that. I know it should work without it, or at least thats the last I’ve heard from customers.

I’ll double check my docs to make sure that param is added.

#7

Gavin Lawrie

OK - I guess I’ll have to come up with some other kind of approach for the filtering. But thanks for the help.

Just to confirm, with the exception of this filtering thing, Low Reorder is working just fine with Publisher on our site.

Login to reply