Try our conversational search powered by Generative AI!

Thomas Krantz
May 25, 2011
  7352
(2 votes)

Visual Studio 2010 Add-In for sorting language XML files

Background

As EPiServer sites grow, their language files usually grows rapidly as well. It’s not uncommon to have several hundred lines of language keys split into different files.

Maintaining such a site and making sure all language keys are translated in all languages can be a pain. I think there are a few Admin plugins for addressing these problems as well.

In our team we have a common practise to always have one language file per language, and to have them alphabetically sorted. That way, you can easily navigate through them, and by just comparing the line numbers you see if there are differences. No Admin plugins needed.

Problem is, to continuously sorting your keys in alphabetical order, can also be a pain :)

Solution

I put together a simple VS 2010 add-in, which installs to the right-click menu in Visual Studio.

editor_before

Once clicked, the XML will sort on element name, like so:

editor_after

Installation

The attached zip contains two files.

files

Put them in your /Documents/Visual Studio 2010/Addins folder

Visual Studio will pick up the addin:

manager

Feedback

Take it for a spin! Of course this add-in should work on any XML, even if it would be kind of pointless to sort your Web.config :)

Feel free to email me or twitter at @thomas_krantz

I’ll put the source code online somewhere if somebody is interested.

Here’s the file:
May 25, 2011

Comments

Henrik Buer
Henrik Buer May 25, 2011 08:36 AM

Nice one! Haven't tried it yet but I sure will...

May 25, 2011 09:00 AM

For the last six months I have been working on a large global site build.

As one of my colleagues was quickly getting annoyed with maintaining the language file. He developed a VS Macro which would essentially take the text you have selected within a file (.aspx, .ascx, .cs) and replace it with either an inline Translate(), a literal with the text bound to an inline resources call. The originally selected text would be placed in the language file in a relevant element heirarchy based on the file you are editing.

This has saved us hours of time over the last few months. I will have to look at tidying it up and there could be the possibility of sharing it if people are interested.

Thomas Krantz
Thomas Krantz May 25, 2011 09:55 AM

Croweman: Interesting approach, that would sure make it alot easier working with language keys.

Anders Hattestad
Anders Hattestad May 25, 2011 02:48 PM

Like the consept, great when all those language files grows out of control:)

but if you are on CMS6 you could use
http://world.episerver.com/Blogs/Anders-Hattestad/Dates/2011/5/IteraTranslate-a-Web-ControlBaseUserControl-that-translate-key-phrases/

Emil Lundin
Emil Lundin May 25, 2011 03:57 PM

Croweman: Yes, please share. Sounds awesome!

samuel.mitts@halvarsson.se
samuel.mitts@halvarsson.se May 26, 2011 01:47 PM

Great! Thanks! Will use this and tell my colleagues about it.

May 27, 2011 11:15 AM

The Macro has been released for public consumption here http://world.episerver.com/Blogs/Lee-Crowe/Dates/2011/5/Language-File-Population-Helper-VS-Macro/

Jose Cortes
Jose Cortes Sep 29, 2011 06:46 PM

Hi Thomas, I've tested your plugin and works fine, but I want to use it to sort my web.config and I need to re-define the sorting when you have many settings, I would like to have it sorted my the name of the setting. So.... could you please send me the code and I'll code it.

Thanks a lot

Vilsan Robin
Vilsan Robin Jul 3, 2012 06:05 PM

Hi Thomas.
Thanks for sharing this..
Its very useful article
could you please send me the source code.my email id is vilsanrobin@gmail.com

Thanks

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