Multilanguage - How do we can change language culture of Links used in Rich Text Editor or Header /

anup goswami asked on November 2, 2021 15:46

Hello Team,

We are using Kentico and right now we are facing a few issues which are related to Language switcher in a Multilanguage site.

We have created links in Header / Footer using “en-us” and we used the same language while adding links in Rich Text Editors.

Is there any way to change language culture of links automatically while switching the language?

For Example: Suppose we have URL on links “…/en-us/products/product-sample” for “en-us” then It must be converted to “…/en-ca/products/ product-sample” when we switch the language to “en-ca”.

Is there any way in Kentico to convert the language culture without creating new link for that specific language?

Recent Answers


Juraj Ondrus answered on November 3, 2021 07:50

What version and development model are you using? E.g. in previous versions, when using Portal engine, there was the option to use language prefixes. So, you would use relative links like "/foo/foo" and the system automatically generated language prefix according to the culture "/en-us/foo/foo" or "en-ca/foo/foo". Please see the documentation.
If you are using MVC development model, this should be ensured by your routing code.

0 votesVote for this answer Mark as a Correct answer

anup goswami answered on November 8, 2021 08:41

Hi Juraj Ondrus,

We are using Kentico 12 SP and MVC development model.

0 votesVote for this answer Mark as a Correct answer

anup goswami answered on December 1, 2021 10:04

Hello Team,

Is there any other way to resolve this issue?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on December 1, 2021 10:05

What are the steps to reproduce the issue using out of the box installation and the Dancing Goat MVC project? What is the URLs and cultures configuration and what code are you using? Have you checked the documentation linked above?

0 votesVote for this answer Mark as a Correct answer

anup goswami answered on December 13, 2021 16:44

Hi Juraj Ondrus,

Yes, we can take reference of Dancing Goat MVC project to reproduce this requirement.

Example:

Please insert a link ”~/en-US/Contacts“ on “Text” field of “/Home/Our Story” content.

Now open the home page URL (http://localhost/Kentico12_DancingGoatMvc/) and view that link at “Our Story” section by using both languages: English and Español.

For both the languages (English and Español), that link will display same language as: http://localhost/Kentico12_DancingGoatMvc/en-US/Contacts

So, is there any way to convert “en-us” URLs which are used inside Rich Text Editor automatically to the newly switched language?

For English that link should display: http://localhost/Kentico12_DancingGoatMvc/en-US/Contacts

while for Español: http://localhost/Kentico12_DancingGoatMvc/es-ES/Contacts

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on December 14, 2021 07:06

How did you added the link to the page in the Spanish version of the page? This seems to me you are using the same content for the EN as well as ES page. When I edit the "Our story" page in the Spanish culture, I am getting the right link to be inserted. Sample screen shot. It seems to me that you are re-using EN content on ES page and it makes sense that the URL contains the content from EN version as these values are stored in CMS_Document table, which holds culture specific data. Please see this documentation.

Maybe you shall not use Kentico's language prefixes for the URLs and instead, parse the content when retrieved in the front end app and add the language prefix on your own based on the current culture.

1 votesVote for this answer Mark as a Correct answer

anup goswami answered on December 14, 2021 18:45

Thank you Juraj Ondrus, I will implement "...you shall not use Kentico's language prefixes......" suggestion.

0 votesVote for this answer Mark as a Correct answer

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