# Output modifier salad in 2 languages

**URL:** <https://community.modx.com/t/output-modifier-salad-in-2-languages/2781>\
**Category:** General\
**Created:** [June 26, 2020, 8:30am UTC](https://community.modx.com/t/output-modifier-salad-in-2-languages/2781 "2020-06-26T08:30:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![elz064](https://community.modx.com/user_avatar/community.modx.com/elz064/32/89_2.png) [@elz064](https://community.modx.com/u/elz064)\
**Post date:** [June 26, 2020, 8:30am UTC](https://community.modx.com/t/output-modifier-salad-in-2-languages/2781/1 "2020-06-26T08:30:18Z")

</div>

Again unable to make output modifiers to work  
(real lack of sample in the official doc by the way)

I need to display a string that comes from previous process in a place holder BUT for some reason this string must have its value changed is one case.  
this [[+nomFacet]] is used in a little tpl, that is call multiple times in each regarding pages (in some filtering buttons blocks)

I choose to set a specific new i18n lexicon entries (fr + eng) for this alternate value.

The logic is:  
if [[+nomFacet]] is=`Particle size` or is= `Taille particule` (comes in one or another language)  
then show the alternate value from the lexicon  
[[%i18n.Facet\_dim\_part\_[[+thisParent]]? &language=`[[++cultureKey]]` &namespace=`i18ncustom`]]

**else**  
use the originale value of the place holder [[+nomFacet]]  
2h30 on it, I abdicate… can’t definitively understand the :default:hide:show is=`:or:is=`:else=`` salad bar.

Thank you.

---

<div class="post-metadata">

**Author:** ![bruno17](https://community.modx.com/user_avatar/community.modx.com/bruno17/32/71_2.png) [@bruno17](https://community.modx.com/u/bruno17)\
**Post date:** [June 26, 2020, 9:19am UTC](https://community.modx.com/t/output-modifier-salad-in-2-languages/2781/2 "2020-06-26T09:19:46Z")

</div>

You should try to avoid having logic like that within the templates.  
Maybe. you could handle the logic there, where you set the placeholder for [[+nomFacet]]

---

<div class="post-metadata">

**Author:** ![elz064](https://community.modx.com/user_avatar/community.modx.com/elz064/32/89_2.png) [@elz064](https://community.modx.com/u/elz064)\
**Post date:** [June 26, 2020, 9:57am UTC](https://community.modx.com/t/output-modifier-salad-in-2-languages/2781/3 "2020-06-26T09:57:07Z")

</div>

hi  
again if modx proposes output modifier and no one can use them… something is wrong

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [June 26, 2020, 11:08am UTC](https://community.modx.com/t/output-modifier-salad-in-2-languages/2781/4 "2020-06-26T11:08:42Z")

</div>

Maybe this works:

```auto
[[+nomFacet:is=`Particle size`:or:is=`Taille particule`:then=`[[%i18n.Facet_dim_part_[[+thisParent]]? &language=`[[++cultureKey]]` &namespace=`i18ncustom`]]`:else=`[[+nomFacet]]`]]

```

---

<div class="post-metadata">

**Author:** ![elz064](https://community.modx.com/user_avatar/community.modx.com/elz064/32/89_2.png) [@elz064](https://community.modx.com/u/elz064)\
**Post date:** [June 26, 2020, 11:29am UTC](https://community.modx.com/t/output-modifier-salad-in-2-languages/2781/5 "2020-06-26T11:29:46Z")

</div>

thank you

this seems to gives some results, but unfortunately never grab the i18n string when it should (always the original place holder value.  
Tested with a basic string instead of the lexicon call: same  
As I also put the[[+nomFacet]] in the code I can see the values it takes.  
this prooves the test does not do its jobs as intented…

---

<div class="post-metadata">

**Author:** ![halftrainedharry](https://community.modx.com/user_avatar/community.modx.com/halftrainedharry/32/1063_2.png) [@halftrainedharry](https://community.modx.com/u/halftrainedharry)\
**Post date:** [June 26, 2020, 1:19pm UTC](https://community.modx.com/t/output-modifier-salad-in-2-languages/2781/6 "2020-06-26T13:19:09Z")

</div>

I can’t reproduce your problems. Maybe it is a caching issue.  
Do you gain any new insights when you execute this testing code:

```auto
nomFacet (cached):|[[+nomFacet]]|<br>
nomFacet (uncached):|[[!+nomFacet]]|<br>
thisParent (cached):|[[+thisParent]]|<br>
thisParent (uncached):|[[!+thisParent]]|<br>
translation (cached):|[[%i18n.Facet_dim_part_[[+thisParent]]? &language=`[[++cultureKey]]` &namespace=`i18ncustom`]]|<br>
translation (uncached)|[[!%i18n.Facet_dim_part_[[!+thisParent]]? &language=`[[!++cultureKey]]` &namespace=`i18ncustom`]]|<br>
if-clause (cached):|[[+nomFacet:is=`Particle size`:or:is=`Taille particule`:then=`translation`:else=`original text`]]|<br>
if-clause (uncached):|[[!+nomFacet:is=`Particle size`:or:is=`Taille particule`:then=`translation`:else=`original text`]]|<br>

```

---

<div class="post-metadata">

**Author:** ![elz064](https://community.modx.com/user_avatar/community.modx.com/elz064/32/89_2.png) [@elz064](https://community.modx.com/u/elz064)\
**Post date:** [June 26, 2020, 1:36pm UTC](https://community.modx.com/t/output-modifier-salad-in-2-languages/2781/7 "2020-06-26T13:36:02Z")

</div>

Thanks a lot.

I think I’ve tried some I’ll give another tr on Monday. But the solution will probably come from de php inside our specific snippet that produce a lot of those stuff.

---

<div class="post-metadata">

**Author:** ![bobray](https://community.modx.com/user_avatar/community.modx.com/bobray/32/46_2.png) [@bobray](https://community.modx.com/u/bobray)\
**Post date:** [June 27, 2020, 9:33pm UTC](https://community.modx.com/t/output-modifier-salad-in-2-languages/2781/8 "2020-06-27T21:33:16Z")

</div>

Output modifiers tend to fail when they reach a certain level of complexity, and/or nesting. The problem is that parts of the modifier may not have been parsed at the time that other parts need them.

A custom snippet that replaces all the modifiers is almost always faster and more reliable.
