Copied to clipboard

Flag this post as spam?

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


  • Ivan 165 posts 543 karma points
    Sep 19, 2012 @ 18:44
    Ivan
    0

    What is the best way to translate macro?

    Hi guys.

    I have a macro that contains static markup like this, for example:

     

    <p><a href="http://umbraco.com">Visit official website</a> to learn more about Umbraco CMS.</p>

    <p><a href="contact-us.html">Get in touch with us</a> to find out how we can help you with Umbraco CMS.</p>

     

     

    At the same time there're several languages supported on the website (dk, uk, es, jp).

    What is the best strategy to translate the macro?

    Currently the only option I see is to use separate (translated) macro per each language.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 19, 2012 @ 18:58
    Jan Skovgaard
    1

    Hi Ivan

    You hould use dictionary items to tranlate any static text you have on your site.

    Go go the settings section and do the following

    1: Add the languages you will be using in the language folder

    2: Figure out what texts and single words and perhaps links, that need to differ for each language

    3: Create the neccessary dictionary items and add the translations for each language. Wether or not you're using XSLT to render you macroes I think that you will benefit from reading through this guide by Chriztian Steinmeier: http://pimpmyxslt.com/articles/dictionary-items/ - I think that the benefit of structuring and nesting the items like Chriztian describes is the proper approach wether or not you render the data using xslt.

    Please also be aware that you need to be certain about how you structure and organize your dictionary items since you can sort, move, or copy dictionary items. Once they're created you only have the option to delete them. If you would like to have some more options managing dictionary items then please vote up this issue on the issue tracker: http://issues.umbraco.org/issue/U4-689 :)

    If you need to have website editors editing the dictionary items but are not really keen on giving them access to the "settings" section you can install this package http://our.umbraco.org/projects/backoffice-extensions/digibiz-dictionary-section by Jeroen Breuer that makes it easy for editor to edit the items.

    Judging from the example above though I'm not sure that such text and links are best handled by being written in a macro? What is the purpose of this macro? It seems to me that this kind of text should perhaps be found on a settings node instead where it's possible to use a content picker to select the correct links - or even just let it be editable in a rich text editor.

    Looking forward to hear more about your scenario for the macro above :)

    /Jan 

  • Ivan 165 posts 543 karma points
    Sep 19, 2012 @ 22:24
    Ivan
    0

    Hi Jan.

    Thank you for your support.

    What I'm trying to achive is to allow editors to insert the macro via RTE on any page they want. The reason I'm using the macro (rather than anything else) is that this chunk of code is repeated over and over again throughout the website.

    The approach you suggested is quite good, and fits me except one thing...

    Now the macro contains the following code:

    <a href='@Parameter.SiteURL' title='Click here to visit Umbraco official website.'>@Dictionary["VisitOfficialWebsite"]</a> @Dictionary["ToLearnMoreAbout"] @Parameter.CmsName.

    The problem is with the "title" attribute, because it's based on paramenter @Parameter.CmsName and cannot be "dictionarized".

    The title string could be, for example:

    title='Click here to visit Umbraco official website.'

    title='Click here to visit Sitecore official website.'

    title='Click here to visit Dynamicweb official website.'

    title='Click here to visit Typo3 official website.'

    So, any solutions on the problem?

Please Sign in or register to post replies

Write your reply to:

Draft