Have you ever (or have your customers) created and edited a page in one language only to realize that their selected locale was wrong? Have you ever wished you could delete a master language branch of a page  after creating its localized counterpart but you could only delete the newly created slave language instead? Have a customer ever requested that they could copy a whole branch and you convert it to another language so that they could then translate in-place?

Well I have… and I’m sure I will. And so did Fredrikj on the our #epicode IRC channel ;).

Basically I had the tool that would convert from one language to another, but Fredrikj requested something that would switch master language of a page from one to another. Since I’ve already had some of the work done, I’ve updated the stored procedure I’ve written some time ago and slapped a nice GUI up on it. Here’s the result:

 

AndvancedLanguageTool

What the tool allows you to do is perform either language conversion or master branch switching on a selected page and all of its children (if you choose so).

The stored procedure have been updated to work on CMS5 R2 (will no longer work on R1 – but if you need that functionality, comment here or give me a shout and I’ll create a compatible version for you).

A word of caution though – I take no guarantee whatsoever about its operation. Especially, if you wreck your client’s database with it. I did what I could to prevent some of the obvious problems (like switching to a non existing master or converting to an existing one) but I will not be responsible if it won’t work for you. make a database backup and experiment there before you do any changes on the real data. That said – it works for me, so I think it should also work for you.

You can download the archive containing the tool here. unzip it to your EPiServer web application folder keeping the folder structure or the plugin reference will be wrong. Include the *.aspx and the *.cs files in your project and apply the SQL file to your database (The manipulation is performed by a stored procedure located in the file).

Also if you’re performing the change in a load balanced environment, you may need to restart the other servers once you do the changes. I reset the DataFactory cache, but I am not sure it propagates through to other servers.

1 Star2 Stars3 Stars4 Stars5 Stars (5 votes, average: 4.60 out of 5)
Loading...Loading...



This entry (Permalink) was posted on Monday, April 6th, 2009 at 4:49 pm and is filed under .Net Framework, ASP.NET, C#, Code Samples, Downloadable, EPiCode, EPiServer, Microsoft SqlServer, Open Source, Software, Software Development, Solution, Web applications. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response , or trackback from your own site.



  • http://antecknat.se Erik Nordin

    Nice work Adam!

  • Fredrik Josefsson

    Very nice Adam, thanks for the code! Oh, and thanks for the mention ;)

  • Thomas Solbjør

    Excellent. Havent tried it yet, but if it does what is says it will add something that should have been a standard function in the product!

  • Neal Sanky

    Brilliant Adam!
    I’m relatively new to EPiServer and I was perplexed why EPiServer didnt have this functionality built into it.

    Thanks, this has definitely saved me many days of frustration.

  • Jon Haakon

    Downloaded it, and tried it, but the downloadfile lacks some files. In the sourcefile for the page I can see reference to “/to/javascript/system.js” that is important to make it work.

  • Jon Haakon

    Problem solved. Changed the reference to the system.js file to my relatively to my project.

  • Neal Sanky

    As a follow up, does anyone know how to programatically change the Available Languages for the page you’ve just processed with this tool?

    For instance, the page to process has set Available Language to English. Then we use the tool to change it, and its children, to French, how can we programatically update the Available Language from English to French?

    thanks again Adam for this great tool!

  • http://www.najmanowicz.com/ Adam Najmanowicz

    hi Neil,

    I have not so far needed that but by a quick glance in the SDK I would suggest you look at the EPiServer.DataAbstraction.PageLanguageSetting class. it seems to have load and save methods as well as some basic manipulation regarding fallbacks

  • Pingback: Tweets that mention Advanced Language Manipulation Tool for EPiServer | Codality -- Topsy.com()

  • http://www.vertexgroup.com Viv

    Hi. We are still on CMS5 R1 but this tool would be a massive help as I’ve got regional sites that need to be moved into a single global site. Is there anything i can do to get this tool working with R1? It looks perfect but we cant upgrade to R2 for various reasons.

  • http://www.najmanowicz.com/ Adam Najmanowicz

    Viv, I am afraid the tool won’t solve your problem. How I assume your sites are structured is that they are separate trees in the CMS.

    The tool will not integrate such sites into a single structure, the only thing it does is convert a wrongly attributed language tags on a page.

    That said – the tool was initially developed on R1, but was significatyly enhanced since then. I suppose I could modify the stored procedure to work with the R1 database again, I would just need the precise revision of the CMS that you use (the database version).

  • Øyvind Wabakken Hognestad

    This is a nice plugin, often necessary after migrated a site. The bad thing is that it’s not uploaded to a community source project place like epicode / codeplex etc so the module could be updated by those who use it.

    There is a problem when changing a language like this and not updating all the needed tables. In this case, the tblKeyword is not updated so the SearchDataSource will fail for all searches using the default EPiServer search.

    Take a look at this bloggpost and my comment.
    http://world.episerver.com/Blogs/Per-Bjurstrom/Archive/2009/6/Performance-How-to-disable-keyword-indexing-in-SP2/#comment36085

  • http://www.najmanowicz.com/ Adam Najmanowicz

    About the above comment – we agreed that Øyvind will upload the code to epicode and add the necessary changes, which he has my permission to do.

    Nice catch with the search tables, thanks Øyvind!

  • Anders S

    Hello.

    I can not get this to work.

    The referense to the two javascript files,

    “/to/javascript/system.js”
    “/to/javascript/pagetreeview.js”

    What should that be?
    It seems that they can not be found.

    Regards,

    Anders

  • http://www.najmanowicz.com/ Adam Najmanowicz

    Andres, those references are not needed there, they are just copied form my template page where I experiment with things. go ahead and delete the lines referring to those scripts – all the functionality in it is server side.

    The reason however for it not working for you might be that
    a) haver you applied the stored procedure to your database?
    b) are you running the same Episerver version that was current at the time the article was created? I believe it’s CMS 5 R2, but can be off right now. In which case the stored procedure might simply be off in terms of the database structures.

  • Mathias Frodin

    I downloaded the module available from EPiCode and installed it and everything seemed to work fine. My problem is when I try to click the button to select page to do the convertion from, then I get a a javascript saying “Object required”. That usually means that a system.js is missing but it seems to be there, so what am I missing?

  • http://www.dobox.com/ Bruce

    This is a nice plugin, often necessary after migrated a site. The bad thing is that it’s not uploaded to a community source project place like epicode / codeplex etc so the module could be updated by those who use it.

    There is a problem when changing a language like this and not updating all the needed tables. In this case, the tblKeyword is not updated so the SearchDataSource will fail for all searches using the default EPiServer search.

    Take a look at this bloggpost and my comment.
    http://world.episerver.com/Blogs/Per-Bjurstrom/Archive/2009/6/Performance-How-to-disable-keyword-indexing-in-SP2/#comment36085

  • http://jenscode.wordpress.org Jens Pettersson

    Thank you! Worked like a charm. I exported a couple of hundred pages from an EPi 4 site and when I imported them the language was wrong.

    This tool saved my day. Thanks!

    //J

  • http://www.epinova.no Andreas Nicolaisen

    Just for the record; This Tool also work for EPiServer CMS 6.
    To get it to work you have to do a few things:
    1. Change the EPiServerUI:ToolButton to a regular asp:Button
    2. Remove the “Register TagPrefix=”EPiServerUI” asembly=”EPiServer.UI” Namespace=”EPiServer.UI.WebControls” in the top of the LanguangeTool.aspx page
    3. Remove the using EPiServer.UI.WebControls; statement in LanguageTool.aspx.cs
    5. Add the system.js and the pagetreeview.js files to your solution and change the paths to the correct ones in LanguageTool.aspx page. The files is usually located in C:\Program Files (x86)\EPiServer\CMS\6.0.530.0\Application\UI\CMS\Javascript

    Now it should work in CMS 6 as well.

    /Andreas

  • http://www.frederikvig.com Frederik Vig

    @Andreas – The code is on EPiCode (EPiCode.LanguageTool), would be great if you could update it and create an EPiServer CMS 6 version as well :).

    Cheers

    Frederik

  • Mari Jørgensen

    Regarding module on EPiCode and issue with search indexes, see:
    Changes to the Advanced Language Manipulation Tool

    /Mari

  • Miklos Kanyo

    Thanks a lot for this, just what we needed !! :-)

    Miklos

  • EJay

    Exactly what I needed, thanks a lot!
    Also @andreas for the epi6 changes