Subscribe: RSS
  • unforgiven666 Reply #1, 3 months ago
    Hi, I'm trying to make a multilingual website using Babel. I will have 4 languages. I have been following a tutorial from Menno Pietersen (https://anyscreensize.com/blog/modx-multilingual/ ), everything works great like it has to.

    Right now I have 4 language pages and every page will contain two subpages, so I have 3 templates for each page. I have created home pages for other languages by duplicating the main page(web) and then put it under the appropriate language tree, like you see on the picture:

    https://imgur.com/a/6a1GV

    Right now i have a Content field for each language page, which has too much of a html code inside of it.

    QUESTION: How to load the pages so only the text in the pages will refresh without loading the whole template again if I switch between the languages?

    Thank you for your help, Miha.
    • Mate if you create different pages with different languages the jump between pages is inevitable, because is the way you build it.

      If you only want to change the text you'll need build the page using AJAX or any other technology, or using Lexicons to change only the text but this is not about babel or ModX, it's about how you build the page structure, try search for a template that use AJAX to load the content.
        --
        ysanmiguel.com
      • Quote from: Ysanmiguel at Sep 17, 2017, 02:16 PM
        Mate if you create different pages with different languages the jump between pages is inevitable, because is the way you build it.

        If you only want to change the text you'll need build the page using AJAX or any other technology, or using Lexicons to change only the text but this is not about babel or ModX, it's about how you build the page structure, try search for a template that use AJAX to load the content.
        Thanks for your answer mate! But what about if I want to load different form with FormIt on each language site, is it possible to solve this with chunks?
        • Depending of what you need to do, but if you call formIT into a chunk, you can put that chunk on every template for every language (share it), in that case you should not have any problem.
            --
            ysanmiguel.com
          • Language tags might also work for this (I don't really understand your use case).

            A language tag will display a block of text in the appropriate language. The value it displays can be in a lexicon file, or in the database.

            [[%LanguageStringKey? &language=`en` &namespace=`NameSpaceName` &topic=`TopicName`]]


            The block stored in a single lexicon entry can be up to 64K, and AFAIK, it can contain HTML tags as well.

            If you have a chunk with language tags in it, and Babel uses Contexts, you should be able to display them in the correct language if you create a culture_key Context setting with the two-letter language code and use the tags like this:

            [[%LanguageStringKey? &language=`[[!++culture_key]]` &namespace=`NameSpaceName` &topic=`TopicName`]]


            You'd have to use the same namespace name and topic name for all languages in organizing the lexicon strings.

            Mind you, I've never tried any of this, but I think it would work.

            If you're using FormIt, and you've created the Context Settings, I believe you could also use its language property:

            &language=`[[!++culture_key]]`

              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/MODx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting