We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 49631
    • 7 Posts
    Hello there dear modx community

    We went a different path with our multilingual website. We tried Babel and Lingua. Both are great but didn't provide what we ultimatively needed. We produced a plugin that saves resources as xliff and uploads the files to the crowdin plattform. There our translator can do his work and manage the process. If some translations are ready, the files are pulled automatically and are then integrated into the modx system.

    The last part we need are multilingual friendly urls. Now the only way to do that I found so far would be to manipulate two core functions:

    • getResourceURI() in modcontext.class.php
    • findResource() in modx.class.php

    together with a custom made alias-map.

    I'm very reluctant to modify core functions for obvious reasons. Are there other ways to hook that deep into the system without breaking the possibility for worryfree updates? I guess it would be a plugin with one or more of the system events. But would that work? We would need [[~LINK_ID]] to produce a friendly url in the current language for example.

    Hopefully somebody can point out a more sustainable road.

    Sincerely yours, Adrian [ed. note: adrian.demleitner last edited this post 11 years, 1 month ago.]
      • 47401
      • 295 Posts
      I did a similar thing to a website. you have to use the context plugin, this allows you to have multiple domains pointing to the same website, but different domains are setup in context. you then have to do what is called google href lang. this then will allow you to have 2 domains using exactly the same content, with the exception of the different language. you would then need an add on possible google translate, to do the translation. since we did this we have seen a steddy increase in natural search engine traffic. all seo data on both domains can be the same.
      the only difference being is the meta data showing.

      take a look at google href lang here

      http://googlewebmastercentral.blogspot.co.uk/2013/04/x-default-hreflang-for-international-pages.html

        • 49631
        • 7 Posts
        Hi comp_nerd26

        Thank you for taking the time to answer. Unfortunately I highly doubt that your solution provides what we need. An example:

        1. /software/software-development
        2. /fr/logiciel/developpement-logiciel

        findResource() would provide me with the ressource ID in the first case but not in the second, because there is no entry for that uri. I can easily extract the language, no problem there. I also don't want to duplicate the resource in a second tree like babel does. Lingua handels the translations perfect for our case, but it doesn't handle the multilanguage furls.

        Also [[~ID]] would always generate /software/software-development, as an example - no matter what language is current. Your solutions also doesn't provide for that case.

        Thanks anyways smiley
          • 37377
          • 64 Posts
          Hi,

          How are your resource translations integrated in MODX? Are they stored in the database?
            • 49631
            • 7 Posts
            Hi Steffan

            Besides having the original resource saved in the database, it is also saved as xliff (xml) file. The translations are only saved as xliff. We then pull translated fields via snippet from the files.

            Do you have a suggestion?

            Yours, Adrian
              • 13428 ☆ A M B ☆
              • 1,031 Posts
              Why not use a cronjob or a crowdin trigger url (if such a thing exists) to import them into the database. Then you could make the alias translatable in crowdin and use babel or lingua without fumbling in MODX internal functions.
                • 49631
                • 7 Posts
                Hello Jako

                But neither Lingua nor Babel produce translated furls when using [[~LINK-ID]], right?
                  • 4172
                  • 5,888 Posts
                  might be possible with a custom parser-class and extended modLinkTag - class
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 13428 ☆ A M B ☆
                    • 1,031 Posts
                    You could i.e. work with [[~xx]] for internal links in Babel for the first language and change this during an import of the translations to [[~yy]] based on the content of the babelLanguageLinks TV. xx and yy are the resource ids of the original/translated resource. Babel has different resources for each language as you might know.

                    Or you could build a output filter/snippet for this, that works on parsing and use the xx everywhere in a small construct or you use/modify the BabelLinks snippet for this. [ed. note: Jako last edited this post 11 years, 1 month ago.]
                      • 49631
                      • 7 Posts
                      Hello Jako

                      That certainly would be a possibility. But we want to avoid that at all costs. Our goal is to work with the core snippet. And since we have an external translator, that person wont know the internal IDs and wouldn't be able to change the [[~xx]] to [[~yy]]. We rather use multiple contexts for subdivisions of a company or a multisite website. It can quickly become super messy if you have like 26 divisions, and each has between 1 to 3 languages smiley

                      @Bruno: Could you elaborate? As migx dev you seem to have a much more intimate knowledge of modx than I do for sure!