Sitecore Partial Language Fallback not falling back - sitecore

We are attempting to implement Alex Shyba's Partial Language Fallback module.
I believe we have everything configured correctly based on the video. We've set the fallback language for ES to EN in Sitecore. We've verified there is a ES version of the both the template and the item.
We've enabled fallback on all the fields of the Home template.
After creating the Spanish version in Sitecore, I switch to version and it appears to be properly falling back to EN. Here is how both the Master db and Web db appear in the client:
This is screen shot is the ES version on WEB db. You can see there is content in the image and link fields.
However, when I hit the site, the content returns null and fails to display.
The module is a bit of a pain because of the lack of documentation (that I can find) and good examples on the web.
Could someone provide a link to a good working example or share how they've configured multi-site, multi-language sitecore?

I think you are misinterpreting how the module works. According to the documentation in the link you provided, the module detects the absense of a version in the current context language. If no version is detected, it falls back to the next available language version.
When an item is retrieved from a Sitecore database, the provider
checks whether the item has versions in the requested language. If
yes, then the item is returned to the caller. If there are not
versions in the requested language in the database, then the provider
performs fallback operation:
[Latest available item version in the fallback language is retrieved from the database]
You stated that you've set the fallback for ES to be EN, and that you have verified that an ES version of the item exists. From the modules perspective, everything is hunky dory... there is indeed a Spanish version, and so it will use it and not attempt to fallback.
That said, this doesn't explain why your field would be null while debugging. I suspect you simply need to re-publish the site in both languages.

I understand very well how Alex's Partial Language Fallback tool works. I have recently posted a 10 blog series on the topic in sitecore's technical blog area. If you'd like to see the details about how to configure it and what all the configurations mean, please see this post:
http://www.sitecore.net/Community/Technical-Blogs/Elizabeth-Spranzani/Posts/2014/03/Fallback-Series-Post-2.aspx
You are indeed correct, it is based on field fallback, not on the language version. You need to make sure you have the following:
fallback enabled in the site node of BOTH the site you are using on the front end and the shell site.
Both the web and master database referenced in the standardValues SupportedDatabases setting
Enforce version presence setting in side node set to 'false' or set to 'true' and have the version created in your language
The language you want to have fallback set to fallback to the main language in the system/languages section
The field in the 'english' version of the template is has the 'enable fallback' checkbox checked.
Publish the item in both language versions
You DON'T need to have different language versions of the templates, unless you have the Fallback.VaryFallbackSettingsPerLanguage in the config set to true. And I wouldn't recommend doing that, unless you want the field to fallback in some languages but not others. I haven't run into a scenario where that is necessary. But if you do decide to do this, you will need to make sure the checkbox is checked for every field in each language version.
I have a full working demo of the partial language fallback module here:
https://github.com/Verndale-Corp/Sitecore-Fallback-FullDemo
Make sure to uncheck the Standard fields checkbox when in content editor, to see the 'fallback value' text show to indicate whether a field is falling back. Otherwise, it will just show 'standard values'.
Liz

Related

Can the fallback language be different for different sites on a Sitecore instance?

In Sitecore, I want to set different fallback language for different sites.
For example,
On Site 1: The Languages fr-fr, de-de, da-dk, es-es, pt-pt should fallback to EN-GB.
On Site 2: The language fr-fr, de-de, da-dk, es-es, pt-pt should fallback to EN instead.
So, fr-fr should fallback to en-GB for Site 1 and fr-fr should fallback to EN for Site 2.
Please let me know if this is possible and if yes how? If there are customizations that are required to implement this, is it suggested to have such implementation?
You can enable the language fallback functionality either on item-level or field-level on the relevant sites and on the relevant items, fields, or templates.
The fallback language specified on a language definition item (located in sitecore/system/Languages) applies to all the fields and items across all sites configured on the same Sitecore instance that have language fallback enabled.
You can also set up a chain of language fallbacks. For example, you can specify the language fr-FR to fall back to en-GB and en-GB to fall back to en. If the version in en-GB does not exist for a particular item, then the version in fr-FR falls back to the version in en. Hopefully, this built-in logic will work for your case.
Otherwise, you will need to add a custom language to Sitecore, i.e. your own French one to support the language uniqueness to configure the language fallback at a site level.

Language Fallback not working for Fields with Standard Values (Sitecore 8.1)

We had an issue where we enabled fallback language settings at the item level on a base template so that it would apply to all of our items. It worked for about 90% of our items but not for others even though the sitecore content editor indicated that it was working.
Placing this here for anyone else who has this issue. I didnt find a specific
solution for this issue on Google and was lucky enough to figure it out. Hopefully this can help someone else out too.
Our setup is Sitecore 8.1 with Habitat Asp.net MVC
Here are some steps to make language fallback work for all items by applying item level settings to a base template.
Step 1
First step to enable language fall-back is to set up the fall-back tree.
We can build a hierarchical structure (or simple linear) for languages to fall back to
Example:
In our case we would just do: EN-NZ --> EN
This is done /Sitecore/System/Languages by setting the fall-back language on each of the language nodes:
Step 2
Next we enable the language fall back feature for the site.
At the deployed website locate the config file Sitecore.LanguageFallback.config
And modify the config so that the following settings apply:
<setting name="LanguageFieldFallback.AllowVaryFallbackSettingsPerLanguage" value="true" />
…
<sites>
<site name="shell">
<patch:attribute name="enableItemLanguageFallback">true</patch:attribute>
<patch:attribute name="enableFieldLanguageFallback">true</patch:attribute>
</site>
<site name="website">
<patch:attribute name="enableItemLanguageFallback">true</patch:attribute>
<patch:attribute name="enableFieldLanguageFallback">true</patch:attribute>
<patch:attribute name="enforceVersionPresence">true</patch:attribute>
</site>
</sites>
Recycle the app pool
Step 3
Now the feature is enabled for the site we must enable the feature at the item level.
Navigate to an item in the sitecore content editor and view the Advanced section
If the Advanced section is not visible; select the View tab and check the Standard fields option
Check the Enable Item Fallback option. (Displays item from fallback language if no language version exists )
To restrict a page to a certain language, check the Enforce Version Presence option.
In cases where a version is not found for a specific language, Sitecore's default behavior is to return an empty item. This happens when rendering an item or when trying to access it via Sitecore API.
In cases where there’s no version available for the requested language, this option allows you to tell Sitecore NOT to return an item. This will end up redirecting the user to a 404 (not found) page, or returning NULL when trying to get the item via API.
We can apply these settings on the Standard Template and the setting will apply to all Items that inherit it
Navigate to the Standard Template
Create a Standard Values if does not exist
Set the Enable Item Fallback option
This will get 90% of our items and fields working, however there is a caveat; this only works for fields that do not inherit their values from Standard Values.
You can easily identify these fields by viewing the Item in the content editor
This is something to do with how the Enable Item Fallback option is also inherited from Standard values of Standard Template and Sitecore won’t apply the setting to the fields that also inherit from standard values.
To handle fields/items in this scenario you do one of two things:
Modify the field on the Item so that it does not inherit from standard values
OR:
Create a standard values on the Item template – It will inherit the Enable Item Fallback option from the Standard Values of the Standard Template
Uncheck the option and Save
Recheck the option and Save so that it no longer inherits the setting
Now that the Enable Item Fallback option is not inherited it will apply. The fields on the item that inherit from standard values will now fallback and render
Note:
I believe this is a bug because the content editor still displays the fields as inheriting their content from the fall back language when you change language however the content doesn’t render on the website until you do one of the methods mentioned above
Comments
There is also Field level settings to apply the same setting.
Also worth noting is that if you are having the issue above and apply the setting at the field level, it still won’t work until you do those steps above.
I Faced a similar problem, and here it is why.
In my case I have a datasource template DChild who inherits from another datasource template DMother.
Both DChild and DMother have standard values
When I created an item from DChild template, all fields whose values were been set by the standard values of DChild, were having their language fallback values coming from DMother standard values instead of the DChild standard value.
This was caused because the fallback was not enabled in the DChild Standard Values but was enabled in the DMother standard values.
Tricky huh ?

Sitecore publishing restrictions by language

In Sitecore, the publishing restrictions access via the dialog are stored under the inherited Publish base template - for example, the Item-level Publishable checkbox is stored under __Never publish.
I had expected to be able to restrict publishing by language, but the fields above are shared between languages so apply to all.
Obviously I could unshare the fields, but I'm not sure what other implications there may be. Has anyone tried this or implemented another solution?
You can restrict the publishing of an item by language, but it is also by version. These are stored in the Lifetime field section, rather than the Publishing section.
This will allow you to mark a specific version in a specific language as unpublishable, however it won't affect all versions in that language.
Other than that, an option would be to add a new field to a base template that is Unversioned, perhaps "Publishable In Language". You could then look into adding a new step into the publishItem pipeline that takes this into account when determining whether a version is to be published - this would possibly take place just after the DetermineAction step, where Sitecore uses its own logic to determine if an item is to be published. Unfortunately that class isn't easily overridable and uses private methods, so it's not a great candidate for extension itself.

default languages for items and folders in sitecore

I'm working in a multi-site, multi-lingual sitecore project, and from time to time, someone adds lots of content on certain sub-site, fight hours with the publishing and being unable to see the updated content, and eventually realise after a couple of hours that all the input was in the wrong language for the sub-site.
So i'm wondering if there is a way in sitecore to support the following:
a folder (for a sub-site) that supports that after clicking an existing item below it, the language automatically changes to the default language for the site folder
since the language is automatically changed, new items created below that folder will be created in the default sub-site language, unless the user explicitly changes it to something else
If the above is impossible or not supported, an excellent workaround would be to be able to change the language of an item language version (say, i created an english version for a page on a spanish site with all the content in spanish, so i want to tell sitecore that i want to make this version actually the spanish version, without going into copying fields manually in the translate ui
It sounds like you might want to consider a few things:
The Language Fallback Provider - this allows you to have have content fallback from one language to another if it doesn't exist.
A custom extension (maybe an event handler for item:creating or item:created) to Sitecore to switch the context language based on where an editor is creating an item.
Just ideas right now...
An alternative approach would be to work with language read and language write security settings for your content contributors.
If your contributor for your Spanish site should only be adding items in Spanish then configure their access settings so that they aren't allowed to create content in other languages.
If you have a lot of content that has been entered in the wrong language then you can use the Globalization - Export language tool (from the Start menu) to export it to an XML file, manually replace the language tags (this is as simple as a search and replace on "en>" -> "es-ES>" for example) and then reimport it in the new language using the Globalization - Import language tool. Warning though: this WILL overwrite any existing versions.

Sitecore Language used for Display Name of items in a Treelist or Multilist

In a Sitecore Treelist or Multilist, items available for selection and items that have been selected are displayed using their Display Name. However, the language version that the Display Name is pulled from is the current Client Language, not the currently selected language of the item being edited.
An example illustrates the problem a little better...
We are importing a large amount of content into Sitecore in en-GB. We are not creating en versions of this content. Authors are logging in with a default content language of en-GB. However, Sitecore Client Language is only available in base en. The actual name of these items is not very useful (it's an external system ID), so we want the authors to see the en-GB Display Name in Treelist, Multilist, etc. However since their Client Language is en, they do not.
I see two potential solutions:
Somehow modify or trick the controls into using the currently selected language of the content item when rendering list items. (Preferable)
Somehow duplicate the en Client Language so we can set the user's Client Language to en-GB.
Any ideas on how to execute either solution, or alternative approaches to solving the problem would be appreciated.
Does this get you started?
What if you implement the Language Fallback Item Provider and set en to be the fallback language for en-GB? That will then show the en display name in the case where it doesn't exist for en-GB.