Views: 3220
Number of votes: 3
Average rating:

CMS 7 xml resources tool

I guess there might be a couple of these tools out there but I haven’t seen one so here is my take on it.

Note that this version is for CMS 7 / 7.1 since the structure of the xml files have changed in 7.5.

As we all know localization of page type names, property names as well as all other descriptive texts has always been managed with xml resource files.

Manually editing xml files, especially when you have a multiple language site is a bit of a pain. And with CMS7 we really don’t want to have property names etc in the model classes needing a recompile/deploy just to change a label or help text.

So I decided to build a small tool to give us developers more time to develop fun stuff.

The tool is an admin plugin and looks like this.

Overview

xmlresource1

The dropdown is filled with all enabled languages. If you want to change language change the value and click refresh.

It parses all types, categories, tabs etc in the CMS and tries to get a localized text.

This means that if you for example remove some page type properties you only need to go into the tool and press save on the page type – properties tab to save a new version of the page type properties file. So it’s very easy to keep the xml files updated with no unused texts.

The tool has seven tabs which let you manage texts for page types and their properties, blocks and their properties, Views (solution specific), categories and tabs.

  • Page and block types tab
    Let’s you manage the display name and description text.
  • Page and block type properties
    Lets you manage the caption and help text of each property.

    The difference between the two is that block properties is translated on a per block basis but the page type properties are not.
  • Categories
    Translation of categories defined in admin mode.
  • Tabs
    Translation of tab names defined in admin mode.
  • Views

    The view tab is for customer/solution specific translations.

    The tool parses a xml file with the name Views_XX.xml where XX is the current chosen language code.

    The tool isn’t recursive since I never seen the benefit of nested elements when it comes to translation texts in EPiServer. I prefer to prefix my element names instead. Below is an example for the tool it self.

xmlviews

Usage

The tool is pretty straight forward though mainly aimed for developers. You build your page or block types and before checking in of the code you go to admin mode and setup the correct texts ( don’t forget to check out the xml files for edit if you have any type of source control).

Note that the save buttons are unique per tab. So if you have done some changes to the page type tab you need to save that before proceeding with additional changes.

A unique named xml file is created for each of the tabs.

If you have a multi language site and want to create sample xml files for a translator you can just change the language in the dropdown without click on refresh and then go to each tab and click save to create xml files for that particular language.

Setup

If you don’t set the appsetting “resourcemanagerpath” to the relative path of your xml files it will save files as well as look for a Views_xx.xml file in the lang folder. The path should start and end with a slash

i.e. “/Resources/Langfiles/.

I’ve compiled a package that you can get over at my skydrive. Just unzip the package and drop the bin and plugin folders into your solution. I’ve also enclosed a Views_en.xml file with translations for the tool and of course also the source code.

As I mentioned in the beginning of the post this is for v 7 / 7.1. I have a 7.5 version in the works bat that will be another post.

Hope you find it as useful as I have.

 

Update: Forgot the download link: Skydrive

 

Example images

xmlresource1

 

xmlresources2

 

xmlblock

 

xmlblockprop

 

xmlviews

 

xmlcategories

 

xmltab

Feb 28, 2014

valdis
(By valdis, 2/28/2014 10:17:31 AM)

Waiting for 7.5 version ;)

alf.nilsson
(By alf.nilsson, 2/28/2014 10:41:07 AM)

Great!

I was thinking of something similar, but having a resource provider that reads from content instead of saving xml files.

per.nergard
(By per.nergard, 2/28/2014 11:18:17 AM)

Added the link that I forgot.

@Alf: I thought about different solutions but with very limited spare time this is what I ended up with.
@Valids: I feel the pressure :)

fredrik.haglund
(By fredrik.haglund, 3/1/2014 6:09:27 PM)

Nice!

alf.nilsson
(By alf.nilsson, 3/1/2014 8:38:59 PM)

I totally understand with cutting the Resource Provider due to limited time.

You mind putting it on github or similar and I might contribute?

Jeroen Stemerdink
(By Jeroen Stemerdink, 3/3/2014 5:47:42 PM)

@Alf: Is this what you were looking for? This only has an implementation for categories and "normal" translations though.
https://jstemerdink.wordpress.com/2013/06/20/a-custom-localization-provider-for-episerver-7-2/

Please login to comment.