We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36604
    • 268 Posts
    Hi,

    I'm trying Babel for the first time.
    I followed the tutorial http://designfromwithin.com/995/modx-multilingual-setting-up-babel/ (wich seams to be the only one to be found).

    Things are working half anf half.

    I just did not understood :
    Babel does TV synch , ok it works But:

    How should I deal with chunks ? does it means we have to create specifics Tpl with specifics chunks for each languages ??

    For instance how do you manage a Wayfinder menu wich calls something relative to an id page (so this id is not the one in another langage and WF output nothing).

    Thank you
      • 37330
      • 9 Posts
      I'm in the same boat with chunks. It would be nice to have a cultureKey placeholder to specify chunk names with.

      For example in YAMS (which I used with MODx Evolution) there was a (yams_id) that you could use as a placeholder. That way you could have a chunk for global elements such as chunkName_en, chunkName_es, etc and then call them on the page as chunkName_(yams_id) and they would automatically be included in the output in the correct language. I'll post back if I find a solution, but this seems to be a hinderance.
        • 37330
        • 9 Posts
        [Solved]

        elz064, as is usually the case, after I post something I find the answer on my own, so I thought I would share with you. Something does exist as I mentioned in my previous post. There is a system setting called cultureKey, which you can use to access / set chunks on your pages. Here is an example.

        I have a link on every page of a translated site that says 'Book Now'. I obviously don't want to have multiple template variables to assign that value. I just want one for every language that my site needs translating to. At this stage for me it is just English and Spanish.

        I created 2 chunks, each with their own language text for 'Book Now':

        • BookNow_en
        • BookNow_es

        Then I used the cultureKey system setting inside my chunk call for those items in my template following the MODx Revolution syntax:

        [[++system_setting]] = The syntax for system setting
        [[$chunkName]] = The syntax for a chunk
        [[$BookNow_[[++cultureKey]]]] = Chunk for your template


        The result: Whichever language you are in, it will call the correct chunk.

          • 36756
          • 7 Posts
          Another way is to use lexicons for the text in your chunks.

          The advantage here: You reduce your amount of language dependent chunks by 50%. And if you have to do some changes later, you will be thankful for having used lexicons smiley

          Just put something like this in your chunk:

          [[%text_key1? &namespace='used_namespace' &topic='area_you_chose_when_created_the_entry']]

          (I do not have the correct ' - key on my iPad, so please use the correct ones as usual)

          When you use a second lexicon entry after the entry above in the same chunk, you don't need to specify topic and namespace again. just use [[%text_key2]] and your done.

          If you decide to add another language to you site later, you will just have to add a new translation to your lexicon, correct set up context and add the ressources to the nex context via babel - you do not have to touch the chunks again.