As I mentioned in my previous post in this Language Fallback blog series, once you have decided that using Enforce Language Version Presence is the way to go for your website, you commit your content authors to certain actions that must be taken for content to show up on the website in the various languages. If any of the language versions of an item are missing, then within the context of that language, the item will be considered missing.
I have already discussed how to add a few customizations so that as new items are added to your Sitecore content tree, language versions in all available languages can be automatically added, or added via a ribbon button click.
But there is a scenario where another tool would come in handy. Say the client decides to add a new language to the site. All of the content items already exist and having to click on each one to add the language versions would be tedious at best.
The Language Migration Tool is a great way to quickly add all of the versions of the items in a specific location in the content tree. I got an initial version of this tool from Alex Shyba a couple of years ago. Since then I have added additional functionality to it and my UX team has spruced up the look (it was very engineer-ish before :)) I’d also like to thank Husain Abbasi for helping me out from a UX perspective!
First, before running this tool in 'non dry run mode', make sure to make a backup of your database, always better to be safe.
Now, in the tool, the first three options are the following:
'Select Sitecore Database': this is the database on which the actions should be executed. Master seems like the only logical database, but you do have the options to choose whichever other ones are setup in your system.
'Sitecore Item/Directory Path': this is the path to the root item you want to work with. Depending on additional settings, it will be the single item you are migrating, or the starting point for it and its children. It defaults to /sitecore for you. You will have to put in the rest of the path.
'Dry Run': if this is checked, no actions will executed. It will loop through and output to the log file what it would be doing IF dry run was not turned on.
The next field allows you to specify the action you are taking with this tool, as there are two potential actions.
The first action is the typical action you will almost always be using, Migrate Source To Target Language.
The second action, Remove Target Language, gives you a way of removing a language entirely from the specified location.
The next two fields are Source Language and Target Language. These are defaulted to 'en', but the idea is that you would change the Target Language to the one you want the system to be adding to each item.
An additional checkbox has been added for 'All Other Languages'. When selecting this checkbox, it will disable the Target Language dropdown, as it is no longer relevant. All available languages will have a version added to the item, if they do not already exist. If it comes to a point where you aren't sure if you might have missed some languages in a section and would like some peace of mind that they are all there, this checkbox is useful.
Next are two checkboxes which will allow you to set if the children of the item specified in the Path textbox should also be processed and if it should be recursively, meaning the children's children, etc.
Obviously this is handy when you are adding a new language to a site. There are a lot of content versions to add in this case and it makes the most sense to add it all at once.
The next checkbox:
Is one that I added because the original version of this tool would add a version in the target language regardless of whether it was there or not. So it would add another version, incrementing from 1 to 2, for example. I felt that the main point of this tool is to create missing language versions, there is no need to increment if it is already there.
The following checkbox is critical for solutions using fallback:
When fallback is enabled, we don’t want the values to be copied over into the new language version. We want those values to stay null, so they fall back to the original. This checkbox allows you to specify that you don't want the values to be copied. If you do want the values copied over, you would uncheck this box.
In the case where you are copying values, you may want to set that only the content fields should copy (and not system fields). In that case, you would check the following box:
The final checkbox in the tool allows you to specify if the source version should be deleted.
This would only be the case if there was a problem and all the content was entered into the wrong language by mistake. For example, say you entered all of the Spanish content for a section in the French language versions. You would select French as your Source, Spanish as your target and then check this checkbox. As it adds the Spanish version of each item, it will remove the French version afterwards. Obviously in that case you would have specified that it should transfer the field values as well.
To make this tool easily accessible, put the code into your code base, in 'sitecore modules'. Then in the core database, add a new Application item to the Applications node, named Language Migration:
And then add it to your Sitecore Start menu as an Application Shortcut, named Language Migration:
Running this tool is a big deal and not something that I would make available to content authors or those that are not very familiar with engineering in Sitecore. When our clients need to add another language, we typically have them create a support job and we spend 20 to 30 hours running this tool, QAing, and doing any other additional configurations.
Stay tuned for my next blog post, in which I'm going to discuss another tool, the Language Fallback Report Tool.
Link to Resources:
I like the concept of the dry run feature. Reminds me of the "Test Merge" feature in some version control systems. Nice write up.