Unable to add new Sitecore language due to item naming rules

Just a quick post for any Sitecore administrators or users who come across this problem.

The issue can occur when attempting to add a new language to your Sitecore solution under the /sitecore/systems/languages node in the content tree. When attempting to click “Next” on the spellcheck dictionary step, a popup will alert you that “An item name cannot contain any of the following characters” and you will be unable to continue. If the invalid character list contains the “-” (dash) character then your Sitecore solution has been configured to not allow dashes in item names.

new_language_issue

If you are not familiar with Sitecore from a development point of view it will likely seem pretty stupid to not allow the dash character in item names. However there is definitely a valid reason why this was done by the original developer. Sitecore suggests that the dash character should be added to the “InvalidItemNameChars” setting in the Web.config file as part of a solution to replace empty spaces with dashes in the URLs that are rendered for a Sitecore website (Remember that the site URLs are directly built using the item names or display names).

So if you are stuck and cannot add a new Sitecore language because of this issue, the quickest solution is to temporarily remove the dash character from the “InvalidItemNameChars” setting in the Web.config file if you have access to that file. After succesfully adding your new language you should then add the dash character back in to the “InvalidItemNameChars” setting.

Alternatively you can look at other options for dealing with blank spaces in Sitecore URLs. I really do not agree with the approach suggested by Sitecore which includes adding the dash character to the “InvalidItemNameChars” setting. Instead we now use alternative solutions that are better suited at dealing with Display Names in Sitecore (Since over 90% of Sitecore builds are usually multilingual and will rely on display names instead of item names).

I currently recommend the following module available on the Sitecore marketplace for dealing with blank spaces in URLs. It also has built in support for dealing with special characters in display names which can be important depending on the site language.

Advertisements
Posted in Sitecore

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s