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

    I have a very large HEAVILY customized site that I need to add a French translation to. I'm trying to plan out the deployment using Babel but I see lots of issues that are not directly addressed in the documentation.

    1. GetResources is used extensively to show new articles in different sections, pull specific media type and custom resources as well.

    [[getResources?
      &tpl=`homePageLatestEducational`
      &parents=`12`
      &depth=`9999`
      &limit=`8`
      &sortby=`publishedon`
      &tvFilters=`ShowInUpdates==educational`
      &cacheResults=`1`
    ]]
    


    Will this work in the french translation? The French resources will have a different parent id. Or am I going to have to find and rewrite all the getResources calls to 'detect' the French context and manually pass the correct parent id to it?

    2. Search, Is it possible to limit searches to one context or another, again the basic search has been pretty heavily customized.

    3. Chunks & snippets. most of my included items like headers, footers, callouts, forms etc. are all contained in either chunks or snippets of some description. Babel does not appear to have the ability to translate or have a chunk/snippet in another context. This goes double for the getResources templates am I going to have to create all new chunks and snippets for the French context? - I'll have the same issues with template.
    Needing two chunks for a getResources template is not something I would call 'portable" having to update 2 chunks for the same change can only introduce problems. Is there some way to rewrite just one chunk or snippet so that it can serve both contexts [say with some sort of lexicon setup]?


    Any thoughts or advice on how to tackle these issues would be appreciated.

    -thanks
    -sean
      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525
      • 31946
      • 116 Posts
      Hi Sean,
      I have a site with 3 languages managed with Babel and did it this way:

      1) In the contexts (each language has one), you could set up some custom keys, for example a newsParent Setting:
      [web] key = newsParent, value = 12
      [french] key = newsParent, value = xx

      Then you can call getResources like this:
      [[getResources?
        &tpl=`homePageLatestEducational`
        &parents=`[[++newsParent]]`
        &depth=`9999`
        &limit=`8`
        &sortby=`publishedon`
        &tvFilters=`ShowInUpdates==educational`
        &cacheResults=`1`
      ]]


      This way you don't have to duplicate the getResource Call for each language and you can use the same chunks and templates for each language.

      2) I think SimpleSearch does only search in the current context. Again I have used a Context-Setting like this:
      [[!SimpleSearchForm? &landing=`[[++search_results]]` &tpl=`search_form`]]


      3) In your Templates and Chunks, every String can be loaded by a Lexicon-Entry.
      I have added my lexicon keys in the babel namspace, but you could also create a new one. Here's an example of a string:
      [[%babel.back? &namespace=`babel`]]

      modx will load the string based on the language which is set as cultureKey.
      de = zurück, en = back, fr = retour

      Cheers
        • 26503
        • 620 Posts
        Perfect, solves pretty much all my problems!

        Thanks!
          *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

          Sean Kimball CLP, CLS.
          Technical Director / Sr. Developer | BigBlock Studios
          ._______________________________________________.
          Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
          27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
          phone/fax: 905-426-5525