0

In our application, there are 3 websites and all 3 applications are interlinked with its features. Example: enter image description here

Facebook and Twitter supports multi-language feature with it. There is a dropdown to change the language for both Facebook and twitter.
Sample website multi-lang feature is based on the twitter profile setup.

i.e. When a user sets his language as French, then Sample website will also be loaded on French language. Now, We are removing this dependency, and implementing the dropdown feature for language in Sample website which supports 25 languages while Facebook and Twitter supports only 7 languages.

Since Languages are configured under the sitecore path, /sitecore/system/Languages will be common to all 3 websites when we add a new language in a Sitecore CM.

How to add a new language in Sitecore CM where the versions should be added only to one of the website (Sample website)?

1
  • Can you provide an example or more details on what you want to achieve? Your description is not so clear Dec 5, 2021 at 13:33

1 Answer 1

2

This question may be opinion based and can have different answers. However, I can provide you an idea how I implemented Language Selection feature on different websites. In this case I will only talk about the change required in Sitecore CMS.

Instead of using the Languages from /sitecore/system/Languages, you can create a container item under each site named Language Selector. That particular container will hold the list of languages being supported by the website.

For example, the Facebook and Twitter site Language Selector containers will hold the 7 language each and Sample Site will hold the 25 languages. Please see screenshot below

enter image description here

The items en, fr-FR, de-DE etc is based on a template that you will create which will contain a field as droplist with datasource set to /sitecore/system/Languages

Now, you can even extend this further. Since you have sites having same languages, you can have a global language selector container which will hold shared languages

How it looks?

enter image description here

When using a droplist, it will be specific to this item and it allows you to add other fields such as Flag, Name etc.

You can use a multilist also where you will select all the languages necessary for a site. Then you will have only 1 item to manage.

UPDATE 1

Previously, if I am not mistaken, you were retrieving the list of languages for Facebook, Twitter and Sample from the path /sitecore/system/Languages.

In this implementation, firstly, you need to have a Language Container which will hold languages that are specific to the site. Note that the Language Container and Language item are customs one. In other words, you need to create a template named Language Info where you will have a drop-list field type at minimum. The drop-list will have a datasource pointing to the path /sitecore/system/languages. You may add other fields if you want such as Language Flag etc. The Language Container template is an item that will hold the Language Info. So you can configure multiple languages under the Language Container.

In your backend implementation, you will need to retrieve the languages from the path /sitecore/content/[Sitename]/Language Container (depending on where you created the Language Container). This means that when you will configure for each site the different languages, when querying the Language Container, you will have languages specific to this site instead of the whole list of languages from the system path.

enter image description here

If you want to have the Shared Language Container, you will need to perform the query as follows:

  • Query path /sitecore/content/[Sitename]/Language Container
  • Query path /sitecore/content/Shared Language Container
  • Merge the 2 lists together

P.S: I don't have the specific code but the above helps on how the content tree looks like and based on this, you can easily adapt the code.

4
  • So how will the added 25 languages appear on publishing an item on Sample website alone and not for other two sites?
    – Geetha
    Dec 6, 2021 at 14:28
  • So instead of reading the path sitecore/system/languages, use the path where you have created the container. Dec 6, 2021 at 14:39
  • Can you provide me some example where you have replaced the path sitecore/system/languages, and custom file you have written for this
    – Geetha
    Dec 7, 2021 at 7:23
  • @Geetha please see updated section Dec 7, 2021 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.