Copy link to clipboard
Copied
In the thread Re: Liquid: What are the suggested best practises for multiple languages? only a part of my problem is solved.
I've created a listing web app which contains several data source fields.
These data source fields have multiple values where the client has to choose the applicable (one) value. I.e location: waterfront , rural area, etc. etc.
These values have to be translated from English to Dutch.
So, how do I have to construct my webpage with liquid markup based on the client's input c.q. output?
Thanks for any help.
Kind regards,
Carla
Hi Carla,
You have many options available to you with liquid, so with the datasource_id from the original web app, you can call up another webapp referencing that ID to get the information you want, and collect the data in a collection or display in a custom template (.tpl) file.
Here's an example. Inside your detail.html web app template
Using a collection:
{module_webapps id="3rdPartyWebApp" filter="item" itemId="{{ dataSourceID }}" collection="webAppData" template=""}
{{ webAppData.items[0].descr
Copy link to clipboard
Copied
I've done a few multi-language sites it all depends on what you are trying to do. Because words in one language might be 2 characters and the equal word in the other 10 you need to factor in the design of the site. Unless you are only wanting to translate a little bit of the site (and not the header and footers etc) I would suggest having two templates. It's more work obviously but it's better for the client and the user as both sites can be tweaked to fit the language perfectly.
I understand this is might not what you want to hear but I hope it helps.
Copy link to clipboard
Copied
Thanks for your reply. But the "problem" lies in the web-apps with field type "datasource". These are in English and the stored data in those fields (which are emulated in the back-end as a list-type-field) have to be translated when "called" with liquid.
Do you have a solution for that?
Thanks.
Copy link to clipboard
Copied
When you use another web-app as input for a datasource field you can only retrieve the Item Name value of the web app-item. I would like to display the Item Description al well. In the BC-doc's I can only find examples of displaying Item Description when rendering the web-app on a page.
How can I make it possible to retrieve the Item Description of the datasource web app-item?
Thanks,
Carla
Copy link to clipboard
Copied
Hi Carla,
You have many options available to you with liquid, so with the datasource_id from the original web app, you can call up another webapp referencing that ID to get the information you want, and collect the data in a collection or display in a custom template (.tpl) file.
Here's an example. Inside your detail.html web app template
Using a collection:
{module_webapps id="3rdPartyWebApp" filter="item" itemId="{{ dataSourceID }}" collection="webAppData" template=""}
{{ webAppData.items[0].description }}
Using a template:
{module_webapps id="3rdPartyWebApp" filter="item" itemId="{{ dataSourceID }}" template="display_webapp_description.tpl"}
... content of display_webapp_description.tpl:
{{ description }}
You should be good to go.
Copy link to clipboard
Copied
Hi Stephen,
Thank you so much for your reply. I will try your solution and let you know if it works in my case.
Regards, Carla
Copy link to clipboard
Copied
Hi Stephen,
Your solution just works fine.
Luckily the datasource id and the item-id are the same.
So you can use an "assign" to store the ID {% assign dataSourceID = {{ this.retrieveValue1_id | strip_html }} %} itemId="{{ dataSourceID }}" or just put in the tag itemId="{{this.retrieveValue1_id }}"
Regards, Carla
Copy link to clipboard
Copied
Hi Carla,
To be more precise and accurate, when assigning a variable in this context.
{% assign dataSourceID = retrieveValue1_id %}
you don't need {{ }} inside a {% %} and you don't need "this." necessarily... but yeah, you have the idea spot on with your examples.
Thanks
Stephen
Copy link to clipboard
Copied
Hi Stephen,
Yes, you're absolutely right. A little advice: never post code when it's getting late.![]()
Thanks, Carla
Find more inspiration, events, and resources on the new Adobe Community
Explore Now