Recently I've faced with strange Ribbon issue. It works fine for English (United States) sites, however it doesn't display images for e.g. Russian site.
Searching for solution in Google brought me to this post: http://www.martinhatch.com/2011/01/blank-ribbon-check-your-locale-settings.html. And the solution would be to change web locale from actually needed to English. Of course such approach is gonna bring a lot of localization troubles.
Another workaround would be to install language specific language pack. For some reasons that doesn't sound good for me. Consider having site collection with 50 sites with different languages. Downloading ~150 Mb and installing language pack for each of them is not the best solution.
So, initially the issue is that image URL look like this: /_layouts/1049/images/formatmap32x32.png. 1049 - is locale ID for russian language.
Looking at source code using Reflector just confirmed the fact that URL part after "_layouts/" is web's locale ID which is set in "Site Settings" > "Regional Settings".
I was thinking about different solutions how to solve that and finally went with URL Rewriting solution. I have some experience working with IIS URL Rewriter (hopefully will share it in future posts), so it took me 5 minutes to get it working.
You can read more about IIS URL Rewriter and it at http://www.iis.net/download/urlrewrite.
URL Rewriter has user-friendly GUI which allows to manage providers, route maps and rules. This configuration is stored at the application's web.config. So, I'll just share this part of web.config (put it in configuration > system.webServer element):
Searching for solution in Google brought me to this post: http://www.martinhatch.com/2011/01/blank-ribbon-check-your-locale-settings.html. And the solution would be to change web locale from actually needed to English. Of course such approach is gonna bring a lot of localization troubles.
Another workaround would be to install language specific language pack. For some reasons that doesn't sound good for me. Consider having site collection with 50 sites with different languages. Downloading ~150 Mb and installing language pack for each of them is not the best solution.
So, initially the issue is that image URL look like this: /_layouts/1049/images/formatmap32x32.png. 1049 - is locale ID for russian language.
Looking at source code using Reflector just confirmed the fact that URL part after "_layouts/" is web's locale ID which is set in "Site Settings" > "Regional Settings".
I was thinking about different solutions how to solve that and finally went with URL Rewriting solution. I have some experience working with IIS URL Rewriter (hopefully will share it in future posts), so it took me 5 minutes to get it working.
You can read more about IIS URL Rewriter and it at http://www.iis.net/download/urlrewrite.
URL Rewriter has user-friendly GUI which allows to manage providers, route maps and rules. This configuration is stored at the application's web.config. So, I'll just share this part of web.config (put it in configuration > system.webServer element):
<rewrite>Each time page will try load Ribbon resource URL e.g. /_layouts/1049/images/formatmap32x32.png will be rewritten to /_layouts/1033/images/formatmap32x32.png which is always available. Enjoy!
<rules>
<rule name="HandleRibbonCulture">
<match url="_layouts/\d{4}/(.+)" />
<action type="Rewrite" url="_layouts/1033/{R:1}" />
</rule>
</rules>
</rewrite>
This comment has been removed by a blog administrator.
ReplyDelete