Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bram Loquet 72 posts 102 karma points
    Dec 02, 2010 @ 15:59
    Bram Loquet
    0

    exporting/importing dictionary items

    I was just wondering, am I the only one or should it be handy to be able to export DictionaryItems?

  • Bram Loquet 72 posts 102 karma points
    Dec 02, 2010 @ 16:02
    Bram Loquet
    0

    After all the dictionary items are stored in just 2 table (cmsDictionary / cmsLanguageText)

    Should someting like this make it to the core?
    Should we make a package for it? Like @aim24 said, a package.xml will do.

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Dec 02, 2010 @ 16:22
    Stefan Kip
    0

    Yes that would be nice!

    Last week I had to export dictionary items from my local dev to the staging and production servers, first I did it with SQL Scripts, but the doctionary broke because of these scripts :-/

    So I did it with a package and including all dictionary items and manually removed the unnecessary items, which sucks :P

  • Julius Bartkus 51 posts 76 karma points
    Jan 27, 2011 @ 00:33
    Julius Bartkus
    1

    Here is some kind of solution using /base, however direct integration to backend dictionary UI would be awesome ;)

    [RestExtensionMethod]
        public static void exportDictionary(int itemId)
        {
            XmlDocument doc = new XmlDocument();
            Dictionary.DictionaryItem item = new Dictionary.DictionaryItem(itemId); //Set the item id, check it in the dictionary           
            System.Web.HttpResponse hr = System.Web.HttpContext.Current.Response;
    
            XmlNode node = item.ToXml(doc);
    
            hr.Clear();
            hr.ContentEncoding = new System.Text.UTF32Encoding();
            hr.AddHeader("content-disposition", "attachment; filename=ditems.xml");
            hr.ContentType = "application/xml";
            hr.Write(node.OuterXml);
            hr.End();        
        }
    
        [RestExtensionMethod]
        public static void importDictionary()
        {
            XmlDocument doc = new XmlDocument();
    
            String path = HttpContext.Current.Server.MapPath("App_Data/xml/ditems.xml");  //Upload a file somewhere to reachable place
    
            FileStream stream = new FileStream(path, FileMode.Open); 
            XmlReader r = XmlReader.Create(stream);
            doc.Load(r);        
            XmlNode root = doc.SelectSingleNode("/DictionaryItem");
    
            Dictionary.DictionaryItem.Import(root);
        }

    Please share the improvements or ideas!

    /Julius Bartkus

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Jan 27, 2011 @ 06:20
    Richard Soeteman
    0

    A client of mine is using Direct DB scripts as well. This shouldn't break. @kipusoep Have you done an IISReset when you ran the script?

    Cheers,

    Richard

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Jan 27, 2011 @ 11:37
    Stefan Kip
    0

    Yes I did, probably a fault of my own ;-)

  • Sander Houttekier 114 posts 163 karma points
    Feb 16, 2011 @ 13:23
    Sander Houttekier
    0

    for translations in not umbraco projects,

    resource files are used, and these can be managed with existing tools like Zeta
    http://www.zeta-resource-editor.com/index.html

    Wouldn't it be great if that export could be formatted in a resx schema, 
    that way it can be opened with Zeta and translations can be handled from there

    afterwards imported back again.

    i know what i'm saying does not really import dictionary items itself, its meant more exporting the translations, and importing them back again after sending them via the translator service / client / google translate...

    but its still nice to keep in mind when import / export is beeing programmed, be it core or package, making this possible would be a nice addition.

     

     

     

  • Jonathan Ben Avraham 43 posts 216 karma points
    May 05, 2016 @ 08:50
    Jonathan Ben Avraham
    0

    I have created a package for this which allows you to export dictionary items, import dictionary items and also update languageText.

Please Sign in or register to post replies

Write your reply to:

Draft