<![CDATA[ Babel - Switching between languages without loading the whole template - My Forums]]> https://forums.modx.com/thread/?thread=102847 <![CDATA[Babel - Switching between languages without loading the whole template]]> https://forums.modx.com/thread/102847/babel---switching-between-languages-without-loading-the-whole-template#dis-post-553944 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.]]>
unforgiven666 Sep 15, 2017, 05:42 PM https://forums.modx.com/thread/102847/babel---switching-between-languages-without-loading-the-whole-template#dis-post-553944
<![CDATA[Re: Babel - Switching between languages without loading the whole template]]> https://forums.modx.com/thread/102847/babel---switching-between-languages-without-loading-the-whole-template#dis-post-554073
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]]`

]]>
BobRay Sep 23, 2017, 04:26 AM https://forums.modx.com/thread/102847/babel---switching-between-languages-without-loading-the-whole-template#dis-post-554073
<![CDATA[Re: Babel - Switching between languages without loading the whole template]]> https://forums.modx.com/thread/102847/babel---switching-between-languages-without-loading-the-whole-template#dis-post-554060 Ysanmiguel Sep 22, 2017, 03:04 PM https://forums.modx.com/thread/102847/babel---switching-between-languages-without-loading-the-whole-template#dis-post-554060 <![CDATA[Re: Babel - Switching between languages without loading the whole template]]> https://forums.modx.com/thread/102847/babel---switching-between-languages-without-loading-the-whole-template#dis-post-553973 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?]]>
unforgiven666 Sep 18, 2017, 12:05 PM https://forums.modx.com/thread/102847/babel---switching-between-languages-without-loading-the-whole-template#dis-post-553973
<![CDATA[Re: Babel - Switching between languages without loading the whole template]]> https://forums.modx.com/thread/102847/babel---switching-between-languages-without-loading-the-whole-template#dis-post-553953
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 Sep 17, 2017, 02:16 PM https://forums.modx.com/thread/102847/babel---switching-between-languages-without-loading-the-whole-template#dis-post-553953