Language Fall Back Module

Last year we implemented the language fallback module for a client to enable them to view the website in Canadian French and English. Language fallback module displays the default language version of an item in absence of the french version if the Sitecore context is changed to French.

Language Fall Back Module:-

Install the following packages  from the reference links given below.

  1. Sitecore_6_5_PartialLanguageFallback_ItemProvider-2012_02_02.zip (items and files)
  2. LanguageFallbackCompleteSitecore6_5-2012_02_02.zip(items only)

Files and Configuration:-

Acquire the shared source solutions and build them with the Sitecore libraries specific for your version (your Sitecore.Kernal.dll and any other Sitecore libraries needed)

See the “Shared Source” links below at the end

In the package you will see the following files:-

bin/Sitecore.SharedSource.PartialLanguageFallback.dll

bin/Sitecore.LanguageFallbackItemProvider.dll

Sitecore.SharedSource.PartialLanguageFallback.config

Sitecore.LanguageFallbackItemProvider.config

In Site definitions, add enableFallback

<site name=”website” virtualFolder=”/” physicalFolder=”/” rootPath=”/sitecore/content” startItem=”/Incapital” database=”web” domain=”extranet” allowDebug=”true” cacheHtml=”true” htmlCacheSize=”10MB” registryCacheSize=”0″ viewStateCacheSize=”0″ xslCacheSize=”5MB” filteredItemsCacheSize=”2MB” enablePreview=”true” enableWebEdit=”true” enableDebugger=”true” disableClientData=”false” loginPage=”/LoginRedirect.aspx” enableFallBack=”true“/>

In Web.config change the Sitecore variable “languageEmbedding” to “always” for embedding language in the URL.

Sitecore changes:-

Add the languages (country-Language) to Sitecore (/sitecore/system/languages)

You may need to temporarily modify your configuration to allow an Item name with a dash

<setting name=”InvalidItemNameChars”>

<patch:attribute name=”value”>\/:?&quot;&lt;&gt;|[]-</patch:attribute>

</setting>

Update the two fallback fields on languages

Post1

There are two fallback fields (one for each library)

Data/Fallback {C2E0719F-5806-4E5A-AAFD-7DED272A5601}

FallbackLanguage {892975AC-496F-4AC9-8826-087095C68E1D}

Enable Fallback on Data Templates:

For the fallback module to work you need to enable the fall back on each data template where you want the language fallback to work. When the fall back module is enabled Sitecore will fallback to default language when different language versions for items are not present. Publish the data templates.

Post 2

Code:-

How user would switch languages may be a coding/configuration effort:-

One example is having a language switcher control in the site navigation (like choosing a country)

Also we have written a clientlanguageresolver.cs to intercept the http request to check for cookies, browser settings,etc and the following web.config changes are made to include this :-

code 1

Code 2

Code 3

<httpRequestBegin>

<!– Language resolver from webclient–>

<processor type=”InCapitalCanada.httpModules.ClientLanguageResolver,InCapitalCanada” />

<!– Language resolver from webclient–>

</httpRequestBegin>

Shared Source/Reference Links:-

http://mediacontent.sitecore.net/Support/LanguageFallbackSolution/

http://trac.sitecore.net/LanguageFallback/

http://svn.sitecore.net/LanguageFallback/

http://sitecoreblog.alexshyba.com/2011/08/partial-language-fallback-module-update.html

Language Fallback Sitecore Items:-

All of these data items are now packaged in LanguageFallbackCompleteSitecore6_5-2012_02_02.zip

post 3

Website/App_Config will have:-

post 4

Website/Bin will have:-

post 5

With the above settings and coding language fallback module would work without any errors. I also have a custom dll from Sitecore support for searching French Text from RTE.