How to retrieve data from other cultures in Transformation

kentico team nextscape asked on August 1, 2022 14:04

Hello, everyone.

The sites we support have product pages and have a default culture (en-JM).

We want to display information from the default culture's product pages (e.g. Spec) on the product pages of other cultures.

And if I want to implement that in Transformation(ASCX type), how exactly should I do it? In other words, the question is how can I get the data from the other culture's pages?

As a supplement, the data for the pages we are targeting are those set in the page type 'Fields'.

Correct Answer

Juraj Ondrus answered on August 2, 2022 15:25

You have two options:

  1. When using ASCX transformation, create a custom transformation method is described in the documentation. And then, depending on your exact needs, you will use the API to get the appropriate culture version of the page and its properties.

  2. You could use text/xml transformation and macros in it, for example for system fields:

{%Documents[NodeAliasPath].Documents["< cultureCode >"].DocumentName%}

and for all fields, including the coupled data fields from the page type the macro could look like this:

{%Documents[NodeAliasPath].CultureVersions["< culture code>"].FieldName%}

1 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on August 1, 2022 18:39

This is built in based on a suffix on the end of the transformation's code name. check out the documentation here. Look at the last blue box on the page labeled with: Transformations for multilingual websites

You may need to display different text in transformations based on the currently selected language. If you are using the built-in multilingual support, you can achieve this by creating a separate transformation for each language, using the appropriate culture code as a suffix in the transformation name.

Example:

  • English (default language) transformation code name: cms.news.detail
  • French transformation code name: cms.news.detail_fr-fr

When a user switches the content culture to French, web parts and controls automatically load the French version of the transformation.

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on August 2, 2022 15:27

Actually, just reference the other thread you asked the similar question on:

https://devnet.kentico.com/questions/about-transformations-for-multilingual-websites

1 votesVote for this answer Mark as a Correct answer

kentico team nextscape answered on August 12, 2022 07:23

Thanks to your support, we managed to solve the problem and we're closing it.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.