12

I want to create custom new languages. On-premise or IaaS I can use https://marketplace.sitecore.net/en/Modules/Custom_Language_Registration.aspx to register a new language.

Does anyone have some knowledge adding custom language to Sitecore Azure Web Apps?

1
  • The following blog post is the most up to date, official documentation from Microsoft on registering custom cultures in an Azure App Service. Unfortunately, it's very short, very vague and doesn't mention the actual registration and persistence of the custom culture: blogs.msdn.microsoft.com/appserviceteam/2017/03/07/… Jun 15, 2017 at 17:10

3 Answers 3

9

The very unfortunate answer to this question is that you can't (at least not as of the writing of this answer).

Per this blog post, dated June 2018:

You cannot, at this moment, create a custom culture on an Azure App Service. Cultures are part of the standard operating system and require changes to the registry to modify or add them. An Azure App Service runs in a sandbox which does not allow code or script to modify the registry. I do not work on the team responsible for this Windows feature, but I have confidence the team puts lots of diligence into providing the fundamental capabilities to match the requirements of most global cultures.

It goes on to say:

There is some support for language packs on IIS which I write about here. In this case, you need to install a language pack for the language you want to respond in and the language pack does include the translated version of the IIS errors. But, you cannot install language packs on an Azure App Service platform yourself. To find which language packs are on an Azure App Service instance, you can access KUDU/SCM and dup the contents of the D:\inetpub\custerr directory.

2

This is how I've overcome the custom culture restriction in Azure Web Apps by using URL Rewrite from IIS. Here's a snippet from /App_Config/UrlRewriteAndRedirects.config

    <rule name="RewriteCustomCultures" enabled="true">
 <match url="^(/?)en-(jp)(/?)(.*)?" />
 <action type="Rewrite" url="en-{CustomCultures:{R:2}}/{R:4}" appendQueryString="true" />
 </rule>

Here's a snippet from /App_Config/RewriteMaps.config

    <rule name="RewriteCustomCultures" enabled="true">
 <match url="^(/?)en-(jp)(/?)(.*)?" />
 <action type="Rewrite" url="en-{CustomCultures:{R:2}}/{R:4}" appendQueryString="true" />
 </rule>

Link Provider

The Link Provider must also be modified so that the the URL's generated will use custom cultures instead of the "real" culture inside Sitecore.

Other Culture Info and Localisation

The culture that you have selected may not have the correct number formatting, date / time formatting, Default Calendar Type used (eg. Gregorian, Lunar), or currency formatting. In Windows 10 Control Panel -> Region -> Additional Settings, every single setting that can be overridden can be seen clearly.

Localisation formatting in Windows

You will need to build additional functionality to override each of the settings. Our solution includes having an override checkbox as a configuration Sitecore item for that language to store the exact same settings as Windows Region settings.

Migrating the content

Now that the solution in place, the content needs to be migrated from one culture to another. To ensure that existing content and Sitecore item language versions remain in tact with the appropriate workflow still in place, I have opted to migrate the content directly using Update SQL queries on the master and publishing target databases.

The queries are straight forward, just go through every single SQL Table with the Language column, and change en-JP to en-JM. As the content is changed without going through Sitecore, Content Search indexes, Link Databases and Dictionary file are going to be out of sync and rebuild is required. So make sure you have allocated enough content freeze time for this task. We left this running overnight in the production instance.

Please check out my blog post https://medium.com/@Vincent_Lui/sitecore-cloud-migration-from-on-premise-to-microsoft-azure-platform-as-a-service-paas-part-2-9e1cdff2fbd2

Do shout out if this helps you resolve the problem.

4
  • This is pretty hacky solution, but props for solving a problem by using languages that aren't being used. But won't this make for some interesting translation issues if the page headers arr providing a language different from the language used in text? I don't know if I consider this a solution, but more of hack / work around with potential issues down the line.
    – Pete Navarra
    Oct 29, 2018 at 21:37
  • @PeteNavarra I think your concerns can be addressed by following best practise guides from building multi-lingual web sites. Here's Google's guide on how to do this support.google.com/webmasters/answer/189077?hl=en Oct 29, 2018 at 22:51
  • This solution whilst inventive feels problematic in that you would be assuming the language code you rewrite to will not be used further down the line. Its also confusing for the editor to have to use en-jm for Japanese content. Jan 27, 2020 at 14:31
  • That's why I've changed the language drop down in content editor and experience editor to also reflect the mapping of the languages. Another creative easy is to show the making in the content editor wallpaper to remind users. If you're really concern about future language use, then you'll need to stick to using a VM rather than PaaS to give you full control of the registry. Jan 27, 2020 at 20:31
-2

One of my colleagues wrote this up as a way to shortcut adding a bunch of new cultures...our project required a bunch of "en-XX" for English versions that didn't exist. This talks about setting up a console app, but I wonder if the principle couldn't be modified into a class library that could be run as a web service call to activate?

http://www.integryx.net/post/2018/02/19/add-a-custom-language-definition-to-sitecore

Note, I've not tested this, so I don't know if it'll work for you, but it's programmatic so you can at least get it onto the app service (versus the standard tool I found on the Sitecore marketplace).

1
  • The key here, is that the context is an Azure Web App. A controlled space where we can't run system level code. Oct 29, 2018 at 15:16

Your Answer

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

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