We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 45303
    • 2 Posts
    Ok I'm coming here early and I may find the answer today digging around in the tempting code. But Ill ask in case someone knows a quick answer off the top of there head.

    So I have two sites, one english and one Chinese, the english site is www.example.com the Chinese site is www.example.com/ch/

    What I'm going to do if possible is add a little English and Chinese flag in the header. But id like it to be dynamic so say I'm on example.com/page2 on the english site and I click the flag it would go to example.com/cn/page2 on the Chinese site.

    I'm going to start digging into this today and see what I can come up with. If I find an answer Ill post it here.

    The two separate sites is a whole other story (business decisions I don't have control of) so nothing I can do about that.
      • 44234
      • 219 Posts
      An extra called 'babel' will do exactly what you want, if the two sites are in seperate contexts within one modx install. If its two modx installs on seperate servers then I don't know how you would go about that.

      http://modx.com/extras/package/babel [ed. note: davidpede last edited this post 13 years ago.]
        Find me on Twitter, GitHub or Google+
        • 45303
        • 2 Posts
        Ok what Ive done is just build out two seperate links one for the CN site and one for the EN site. Below is the code I used.

        <a href="http://example.com/index.php?id=[[*id]]"><img src="http://example.com/assets/images/en.gif" alt="English"></a> EN</p>
        
        <a href="http://example.com/cn/index.php?id=[[*id]]"><img src="http://example.com/assets/images/zh.gif" alt="Chinese"></a> CH</p>


        I just have the assets on the one site, as I don't really need to replicate them over same server and all.

        I dropped this into a chunk called language and I call it up using
        [[$language]]
        in the template [ed. note: emerge last edited this post 13 years ago.]