Multisite and Mulitlingual

 Multilingual

Step 1 : To get started, we first need to install the required language. Log into Sitecore and go to the control panel. Under Localization, click Add a new language.




Step 2 : From the dropdown, choose the language you want to add. Notice there are multiple options for Spanish. You can create content based on the language and the region.


Step 3 : The dialog is populated with the language and the region code. These codes will be used by Sitecore when creating links to other language versions of content (ie. /es-ES/about). We do not want the region code, so clear out that box. When Sitecore creates links to our Spanish content, the links will only have the language (ie. /es/about).


Step 4 : In the content editor you will notice that the UI is updated to allow creation and publication of content in Spanish. By default all content authors can create and publish in all installed languages.


You can view you site’s content in Spanish by adding /es/ between the domain name and the page path (ie domain.com/es/about-us) or by adding ?sc_lang=es at the end of the page path (ie domain.com/about-us?sc_lang=es).  Once Sitecore sees either of these language identifiers, it stores the language in a cookie.  If no language identifier is found in the url, it will use the value in the cookie.  The user will browse the site in the last identified language until another language identifier is specified.

Step 5 : This first time you publish content in Spanish and view the page, you will likely get the yellow error screen. Sitecore attempts to get the Spanish version for every content item on the page (header, nav items, subnavs, content, footer, footer links, etc). If there is no Spanish version of a given piece of content, it returns a null object to the view causing this error.


Step 6 : To correct this error we must enable language fall back. This feature was fully introduced in Sitecore 8.1. It allows you to set a default language for your site as well as a fallback language for any installed languages. If there is no version for the requested language, Sitecore will look for the version in the fallback language. 



Step 7 : Next, we need to patch our site configuration to allow language fallback.  Add this patch to a file that will load late in the process according to the naming conventions and structure of the configs for your site.  Note there are two types of fallback, item level and field level.  I found it easier to fall back at the item level because a version of the item either exists or does not exist in the chosen language.  Remember to recycle the app pool after patching the configuration.

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<sites>
<site name="website">
<patch:attribute name="enableItemLanguageFallback">true</patch:attribute>
</site>
</sites>
</sitecore>
</configuration>


Multisite

Consider a new site whose name will be 'local.sitecore92.com'. Configuring this site to Sitecore requires the following steps:

  • Step1: Select an existing item in the content tree (or create one from scratch).
  • Step2: Add your site name to Sitecore Instance and it can be done in the following two ways:

Add the <site> element under the <sites> section of the sitecore.config file.
Or
Add the <site> element under the <sites> section of the SiteDefintion.config file.


Adding a new site to the config file is only the first step. To access the newly added site, there are two other steps that need to be completed outside of Sitecore.

  • Step3: Add the site name to the IIS binding.


  • Step4: Add the site name to the host's file of your server.


You can now access your newly added Sitecore website after completing these three steps.












Comments

Popular posts from this blog

Federated Experience Manager (FXM)

Email Experience Manager (EXM)

Sitecore Products