Running WPML + Toolset, I'm going to create pretty complex forms and views with many custom fields, taxonomies, etc. in several languages.
I don't want to update all the views and forms when I add a language and then forget about something.
I'll take as example category taxonomy, but the solution might work for everything else.
Example for category slugs:
- in English: car-11, bike-22, plane-33, boat-44
- in French: voiture-11, velo-22, avion-33, bateau-44,
- in German: auto-11, fahrrad-22, flugzeug-33, boot-44.
Then I use this wpv-conditional to display content based on following conditions: must be cars and bikes, doesn't matter the language.
[wpv-conditional if="( '[wpv-post-taxonomy type='category' format='slug']' eq ARRAY('car-11', 'bike-22', 'voiture-11', 'velo-22', 'auto-11', 'fahrrad-22') )" evaluate="true"]They have wheels![/wpv-conditional]
That solution actually works: I manually added all the relevant slugs. But if tomorrow I add a language, I've to update each view and maybe forget one line or make a mistake.
Question is: how can I display the slugs depending on the end of it?
You can notice that translations have the same numbers at the end. With such solution, I could just write '11' and '22' and it will display both cars and bikes, doesn't matter on what language. And I'll just have to add the right numbers when I add a new translation for a taxonomy or whatever, without updating Views and Forms.
That doesn't work of course:
[wpv-conditional if="( '[wpv-post-taxonomy type='category' format='slug']' eq ARRAY('11', '22',) )" evaluate="true"]They have wheels![/wpv-conditional]
EDIT:
I guess I've to use something like this: hidden link
But I don't know how to implement that inside wpv-conditional.