5

In a multi-language solution, the developers switch back and forth between multiple languages when creating content, testing, etc.

If the developer forgets to change the context language to English, before creating a new template, only a version in the current context language will be created (along with sections, fields, __Standard Values etc).

Is there any way to force an English version, when a template (and children) is created?

Update

We are not currently using any language fallback features, so we are not facing any concrete issues. The request is mostly for consistency in the solution.

2 Answers 2

6

In a clean install of Sitecore 8.1 update-3, the templates and their related sections/fields are always created in English, no matter what language the user may be working in from the ribbon:

Template

But if your user/developer has changed their language preference in their profile (Control Panel > Region and language options > Display language) then the template is created if their preference language.

Short Answer

The simplest solution is to ensure that the language preference for all your developers/users is English when working with templates.

Long Answer

The issue is in the Sitecore Template Builder code itself. If you feel this is a bug then you should report it to Sitecore and ask for a fix.

My investigation leads me to believe that the issue is in \sitecore\shell\Applications\Templates\TemplateBuilder\TemplateBuilder.xml and it's related CodeBeside located in Sitecore.Shell.Applications.Templates.TemplateBuilder.TemplateBuilderForm in Sitecore.Client.dll

An initial check is made that the user has the correct write permissions to create/edit templates in the language selected from the ribbon, but the sections and fields are created without passing this selected language into account. Instead, all calls are made without any language parameter being passed so it uses Sitecore.Context.Language, i.e. the user preference language stored in their profile.

TemplateBuilderForm.cs

There is no easy way of overriding the methods you need; Save(), SaveTemplate(), SaveSection() and SaveField() are all either non-virtual or private static. Wrapping HandleMessage() in LanguageSwitcher("en") also does not work since the call is initiated with Context.ClientPage.Start() and the language reverts back to the user preference.

You could fix it but not cleanly, it means overriding a lot of code which increases the possiblility of issues if you upgrade and Sitecore changes their own internal implementation.

3

No. But unless you're using fallback features, it shouldn't be a problem for your solution. See here:

Are there any issues with having multiple language versions of templates and template fields?

If you want to remove language versions you don't need, this was answered here:

How to remove a language version of a data template?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.