Per Nergård
Feb 28, 2014
  4724
(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
Opti ID overview

Opti ID allows you to log in once and switch between Optimizely products using Okta, Entra ID, or a local account. You can also manage all your use...

K Khan | Jul 26, 2024

Getting Started with Optimizely SaaS using Next.js Starter App - Extend a component - Part 3

This is the final part of our Optimizely SaaS CMS proof-of-concept (POC) blog series. In this post, we'll dive into extending a component within th...

Raghavendra Murthy | Jul 23, 2024 | Syndicated blog

Optimizely Graph – Faceting with Geta Categories

Overview As Optimizely Graph (and Content Cloud SaaS) makes its global debut, it is known that there are going to be some bugs and quirks. One of t...

Eric Markson | Jul 22, 2024 | Syndicated blog

Integration Bynder (DAM) with Optimizely

Bynder is a comprehensive digital asset management (DAM) platform that enables businesses to efficiently manage, store, organize, and share their...

Sanjay Kumar | Jul 22, 2024

Frontend Hosting for SaaS CMS Solutions

Introduction Now that CMS SaaS Core has gone into general availability, it is a good time to start discussing where to host the head. SaaS Core is...

Minesh Shah (Netcel) | Jul 20, 2024

Optimizely London Dev Meetup 11th July 2024

On 11th July 2024 in London Niteco and Netcel along with Optimizely ran the London Developer meetup. There was an great agenda of talks that we put...

Scott Reed | Jul 19, 2024