Try our conversational search powered by Generative AI!

Per Nergård
Feb 28, 2014
  4654
(3 votes)

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

Comments

valdis
valdis Feb 28, 2014 09:17 AM

Waiting for 7.5 version ;)

Feb 28, 2014 09:41 AM

Great!

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

Feb 28, 2014 10:18 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 :)

Mar 1, 2014 05:09 PM

Nice!

Mar 1, 2014 07:38 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
Jeroen Stemerdink Mar 3, 2014 04:47 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.
Latest blogs
Optimizely and the never-ending story of the missing globe!

I've worked with Optimizely CMS for 14 years, and there are two things I'm obsessed with: Link validation and the globe that keeps disappearing on...

Tomas Hensrud Gulla | Apr 18, 2024 | Syndicated blog

Visitor Groups Usage Report For Optimizely CMS 12

This add-on offers detailed information on how visitor groups are used and how effective they are within Optimizely CMS. Editors can monitor and...

Adnan Zameer | Apr 18, 2024 | Syndicated blog

Azure AI Language – Abstractive Summarisation in Optimizely CMS

In this article, I show how the abstraction summarisation feature provided by the Azure AI Language platform, can be used within Optimizely CMS to...

Anil Patel | Apr 18, 2024 | Syndicated blog

Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog