Today I would like to present to you a prototype I have been working over past couple of weeks. This solution is built around a story about language fallback requirements of a fictitious multinational company. This is just an example of how you can approach similar requirement.
There is a number of alternative solutions that the Sitecore gurus from all over the world came up with, so you could naturally ask me: what is so special about this approach?
Well, here is a couple of things coming to my mind:
1. It is granular, field based solution.
2. It is consistent with the product architecture, relying on proven technologies such as Standard Values provider.
3. It is friendly to business users as they can clearly see what attributes falls back using familiar Content Editor UI.
4. This solution covers all major data access methods: direct API, Sitecore Query, Search via in-built Lucene engine.
I should mention, that Fast Query, is not respecting these settings, because this data access technology is simply not language aware. No language fallback solution that I’ve seen works with Fast Query.
5. It has minor impact on performance – I ran a few performance tests and confirmed it.
6. It is quite generic.
7. It is flexible.
8. It is plug and play.
Anyways, hope you find this useful. Any feedback (good or bad) is always welcome. Enjoy!
35 comments:
Great Presentation and outstanding solution. Thank you!
Natalia
Excellent video Alex! This approach will come in very handy. Thanks for putting this together.
--jeff
Even though I am not fond of language fallbacks, it can be very handy. Your solution is very elegant. And nice video BTW :-)
Thank you for the great feedback - I am hoping to record a more technical session soon. Stay tuned!
Alex, outstanding solution. Did you publish the source code for this article?
Koen
Thanks!
The source code is available on Shared Source:
http://trac.sitecore.net/LanguageFallback/browser/Trunk/Sitecore.SharedSource.PartialLanguageFallback
Let me know your thoughts on it...
Hi Alex,
I installed your solution and changed the itemManager default provider but nothing changed (in the content editor).
I also see that the config you talk about in the video isn't the same as what's mentioned in the documention file (on the shared source lib).
Can you shed a light on this?
thx
Koen
Hello Koen,
The project on tract actually contains two solutions. One is mine (field based), another one is item based. It looks like you have installed the item based solution. The field based does not have the documentation yet, but it is plug and play. All you need is the compiled assembly and a .config file. After that, modify the EnforceVersionPresenceTemplates as needed and use the "Fallback" buttons on the ribbon to configure the fallback for your templates. I covered this in the screencast. Let me know if you have questions.
Thank very much Alex Shyba. It is useful for us.
Excellent solution!
I wish had chosen this approach 2 years ago. We had fallback requirements (on item base), we used a special workflow which copied the item versions in the local languages which is erronous and resource intensive and slows down publication and... and ...
Excellent solution and solves most of my clients needs for languages.
Is there a way to allow the "Preview" mode to show fallback values? Currently only the the fields that have been overridden with specific values show in the "Preview" window.
Hi Alex,
I'm trying to install the fallback solution on Sitecore 6.4 but it generates an 503 error when I included your config file. Not sure what's happening.
Koen
Hi Koen,
Can you confirm you checked out the latest codebase from shared source? There was a problem with circular reference in 6.4 that I fixed some time ago.
If you can confirm, could you please send me your configuration file?
Monty: I have an update for the preview problem. Can you shoot me an email? AS at sc net
I'm having an issue getting it to work properly, it appears to work within sitecore, but when I navigate to the site, I'm not seeing any default language content. I posted in the forum, but I haven't got a response yet. Love the solution, just wish I could get it to work.
Hi Rob,
I've updated the code recently (8 days ago) to support this. This update included both changes in the config file and code.
Please make sure you run the latest version of the code and configuration. Let me know if this does not help.
-Alex
Hi Alex,
Is there a tech document/video available?
Thanks
Asif
Thanks for the reply, I downloaded the new version, but I'm still having issues. I might be having issues with the necessary configuration in the web.config. Could you post the code that needs to be added to the web.config?
Thanks for your help.
Rob,
All the configuration needed is supplied within the auto include config file.
Can you email me (AS at sitecore dot net) and send your web.config, along with the exact version you use?
I'm using the new Language Fallback Module, and want to know that if the item being requested does not have the current language version, and does not have a fallback, will the item returned be null? At the moment, I'm still being returned an item, but if I cast as StubItem, that is null?
We have a multi-site implementation using version SiteCore 6.4.1 (rev. 110324) using .Net framework 4. I have installed the Sitecore.SharedSource.PartialLanguageFallback package. Always Enforce Fallback is working as expected, but I am unable to get Enable fallback If configured to work either in the editor or the published sites. We have a multisite set up and I have set enableFallback="true" for the shell database as well as the one I want to fallback. Do you have any ideas as to why it is not working?
Pilko - can you send me an email with your configuration files (web.config and all from App_Config/Include)?
My initials@sitecore.net
Alex, I've just tried to install your Language Fallback Module into my Sitecore 6.2 site but I got two "Field not found: 'Sitecore.FieldIDs.Source'" during the install. I get the same error whenever I click any item in the content tree.
No one else seems to have had any problems getting past the install.
Any thoughts.
thanks
Hi Mick,
If "enforceLanguagePresence" is enabled for the context website and "Fallback.EnforceVersionPresenceTemplates" settings contains the item template GUID, then item with no language version will be returned as null.
Sounds like this feature is not enabled on your side. So to check whether an item is "translated" or not, do Item.Versions.Count > 0
Hope this helps
Freddie,
The latest version on Trac is built for 6.4, you have a conflict, because the Source property is missing in 6.2.
Try removing line 84 from FallbackLanguageManager.cs and rebuild the code:
if(field.ID.Equals(FieldIDs.Source)) return false;
I had to add this line to avoid infinite code execution in 6.4 and later.
Hope it helps.
Hi Alex,
I think your solution is ideal for my requirements, but I am having issues building the current version. I am on Sitecore 6.2, so needed to rebuild the code to avoid the issue raised by Freddie. However on building the current version against the Sitecore 6.2 dll's I came across the following build issues on the FallbackEditorFormatter:
1. Arguments does not exist in the current context on Arguments.Item.Fields[field.ItemField.ID];
2. InheritsValueFromOtherItem does not exist on itemField.InheritsValueFromOtherItem.
I assume Arguments can be replaced with Args, but not sure about the InheritsValueFromOtherItem property.
Thanks,
Parit
Hi Alex
do you know if the fallback works on 6.5? I added the project, put the config file into the include folder and added a template guid to EnforceVersionPresenceTemplates but I just don't see any change on the desktop... do I need to make additional changes? update the IDs in constants? execute SetupFallbackCommand somehow?
cheers
Michael
PS: I just downloaded the project.. so it should be the most current version
I installed the package for 6.4 and it works almost perfects. the only problem (sadly a killer) is, that I get an "Object reference not set to an instance of an object." on "Field itemField = Arguments.Item.Fields[field.ItemField.ID];" (line 48 of Shell/EditorFormatter.cs) whenever I open a rendering controls edit window... any ideas about that?
Hi Alex
I've installed the module but I'm having problem when the fallback language is set to a language other than en. All of the content will be initially created using the en-GB locale then language variants created thereafter. If I set the fallback language to en it works fine but if I set the fallback language to en-GB the IIS worker process stops on the server due to a stack overflow exception.
Does this have anything to do with the fact all system items (inc data templates) are created using the en locale and not en-GB?
Cheers
James
James,
Yeah sounds like infinite loop.
I just tried the scenario but can't repro on the latest version on 6.5. Set 'en' to fallback to 'en-GB', even tried setting 'en-GB' to fallback to 'en' at the same time, which is a bad idea, but still does not break.
Send me a copy of your serialized content tree so I can repro at: AS at sc dot net.
paHi Alex,
Great video! on top of all these...
If i have a user that create all this pages in japanese language on a eng version.. which is totally wrong way of doing.. is there anyway we can change the version to japanese and we still keep the contents migrated?:) hope to hear from your expertise. kelvin.tang@sungard.com
kelvin,
You would need to have this content transferred from one language version to another via a script. I think I have one. Email me at AS at sitecore do net.
-alex
Alex, been using this for a couple of months, excellent, thanks, all fields throughout the site need to be set to "Enable Fallback If Configured" I tried using a standard value on "/sitecore/Templates/System/Templates/Template field" which appears to generate a recursive loop. Any other idea's of how to do this so that we don't forget to set this value when creating new fields?
Duncan
After configuring everything I only get 2 buttons in the Fallback section on my template items and fields. I have Enable Fallback and Don't Enable Fallback but I don't have Enforce Fallback and Don't Enforce Fallback. If I go to my template field, I also don't have the Enforce Fallback checkbox. enforceVersionPresense="true" is on my website and I un-commented the lines in the App_Config file needed for specifying "EnforceVersionPresenceTemplates".
Hi Frank, that's expected. The enforce feature was deprecated. I did not see any value in it and it was impacting performance.
-alex
Post a Comment