On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • As reported on several occassions over the past week, I’m working on a multi-lingual, multi-domain website (each domain with a different language).
    Now with MODx Revolution 2.0 that’s going to be a lot easier, but we just ran into one issue that sounds small, but can become a very big one:
    The chunks...

    Now there’s a few things that can be done:
    1. If necessary, replace chunks with snippets to make its content variable. However, this would make a mess of the list of snippets.
    2. Make language named copies of the chunks, so "chunk" becomes "chunk-en", "chunk-de" and "chunk-nl", however this would make the list of chunks huge.

    So I was wondering if there really isn’t any other way to do this?

    Help would be highly appreciated!
    • Use Revolution’s Lexicons.

      In your chunk:

      [[%lexicon_entry_key? &topic=`topicName` &namespace=`namespaceName`]]

      So, say you put all your langauge files in the ’mysite’ Namespace (Namespaces can be used to group lexicon entries and topics), and had a Topic called ’sports’. You can create as many Topics as you like. Say you want to grab the Lexicon Entry with the key ’welcome_message’ from the Topic ’sports’.

      You’d then put this in your chunk:

      [[%welcome_message? &topic=`sports` &namespace=`mysite`]]

      This would then render the translation (depending on what language you’ve initialized that Context in) for the Lexicon Entry ’welcome_message’. It would also load the ’sports’ Topic and ’mysite’ Namespace. You only need to load the Topic/Namespace once on a page.

      MODx recommends you prefix your Lexicon Entries with some prefix to distinguish them from other Components Lexicon Entries. But you can do it however you want. smiley

      Please read the Internationalization Documentation for Revolution for more information.
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
      • Thanks a lot!
        I’ll have a look at this and if I run into any kind of problem, I’ll get back here.
        But it sounds very doable.

        Thanks again.