We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28042 ☆ A M B ☆
    • 24,524 Posts
    That's a pretty basic requirement, I would think.
      Studying MODX in the desert - http://sottwell.com
      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
      Join the Slack Community - http://modx.org
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Ok. The snippet (I named it mmlLanguage) works great. I've made a select drop-down for the language menu, so that it will show the current language at the top, but without a value.

      The main "langlinks" menu block looks like this:
      <div class="langlinks">
      <form>
      <select name="URL" onchange="window.location.href=this.form.URL.options[this.form.URL.selectedIndex].value">
        <option value="">[[!mmlLanguage]]</option>
        [![!mmlLangLinks? &wrapper=`@CODE [[+output]]`]]
      </select>
      </form>
      </div>

      And the mmlLinkTpl looks like this:
      [[+language:is=`[[!mmlLanguage]]`:then=``:else=`<option value="[[+link]]">[[+language]]</option>`]]


      http://findisrael.com
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 36549
        • 572 Posts
        Hi,
        I have two issues that i'm struggling with...

        1. The home button from my main navigation when on a secondary language goes to the default language home page. So it defaults to www.myWebsite.com rather than www.myWebsite.com/lang/ - any ideas how I can remedy this?

        2. Does anyone know how I get a breadcrumb trail to work with the translations? I am using the snippet 'Breadcrumb' (http://rtfm.modx.com/extras/revo/breadcrumb/) but can't figure out how to get this to work.

        Thanks for any help
          www.9thwave.co.uk
             WEB | DESIGN | PRINT
          • 4172
          • 5,888 Posts
          1. The home button from my main navigation when on a secondary language goes to the default language home page. So it defaults to www.myWebsite.com rather than www.myWebsite.com/lang/ - any ideas how I can remedy this?

          This should just work, if you did start with a setup like here:
          http://www.webcmsolutions.de/en/modx-extras/migxmultilang/verwendung.html

          If not, we would need to know, what is different at yours.

          2. Does anyone know how I get a breadcrumb trail to work with the translations? I am using the snippet 'Breadcrumb' (http://rtfm.modx.com/extras/revo/breadcrumb/) but can't figure out how to get this to work.

          Use pdoCrumb instaed.
          Example:

                [[!pdoCrumbs?
                  &tpl = `breadCrumbTpl`
                  &tplCurrent = `breadCrumbcurrentTpl`
                  &hideSingle=`1`
                  &includeTVs=`mml_pagetitle`
                  &loadModels=`migxmultilang`
                  &prepareSnippet = `mmlTranslatePdoToolsRow`        
                ]]
          


          breadCrumbTpl:
          <a href="[[+link]]">[[+pagetitle]]</a>
          


          breadCrumbcurrentTpl:
          [[+pagetitle]]
          
          [ed. note: Bruno17 last edited this post 12 years, 1 month ago.]
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 36549
            • 572 Posts
            Hi Bruno,

            Thanks for the heads up about pdoCrumbs.
            As far as I can see the menu is set up as you have indicated:
            [[$nav_multilang]]
            [[!pdoMenu? 
               &startId=`0` 
               &level=`3` 
               &rowTpl=`wfRow_multilang` 
               &parentRowTpl=`wfParentRow_multilang` 
               &outerTpl=`wfOuter` 
               &innerTpl=`wfInner` 
               &levelClass=`level` 
               &includeTVs=`mml_pagetitle,mml_menutitle`
               &prepareTVs=`1`
               &tvPrefix=`tv.`
               &loadModels=`migxmultilang`
               &prepareSnippet=`mmlTranslatePdoToolsRow`
               &excludeDocs=`955,956,957,958,1323`
            ]]


            Template:
            [[!mmlCache?
              &element=`pdoResources`
              &parents=`0` 
              &resources=`[[*id]]` 
              &tpl=`GenericTemplate` 
              &includeTVs=`[[mmlGetTemplateTVs]]` 
              &prepareTVs=`1` 
              &processTVs=`1`
              &includeContent=`1`
              &tvPrefix=`` 
              &loadModels=`migxmultilang`
              &prepareSnippet=`mmlTranslatePdoToolsRow`
              &cache=`1`
            ]]


            The [[+link]] works OK and goes to the relevant home page but the actual Home page link does not append the language key.
              www.9thwave.co.uk
                 WEB | DESIGN | PRINT
              • 4172
              • 5,888 Posts
              what is the generated link?
              what is the cultureKey of this context?
              what is the base_url of this context?
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 36549
                • 572 Posts
                Hi Bruno,
                Hopefully i have understood your questions but please let me know if not...
                1. Presumably you mean the link generated from the home button - it is simply: www.myWebsite.com (i.e, no appended language key)
                2. Do you mean the language keys ‘we’ or ‘en’ ?
                3. <base href="[[!++site_url]]" />
                  www.9thwave.co.uk
                     WEB | DESIGN | PRINT
                  • 4172
                  • 5,888 Posts
                  1. I mean the generated link, when you look into the generated source-code, I think it is not 'www.myWebsite.com' but something like
                  <a href="/">Home</a>


                  2. I mean the system-setting or context-setting of your site. Is it 'we' or is it 'en'?

                  3. What do you get with
                  [[++base_url]]
                  - this is not the site_url
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 36549
                    • 572 Posts
                    HI Bruno,

                    1. yes the generated link is as you say: '/'
                    2. there is only one context, this is not a multi-context site, AFAIK we don't set this - but i'm guessing it's English if going by the multilang stuff.
                    3. When i add [[++base_url]] to a resource i get '/'

                      www.9thwave.co.uk
                         WEB | DESIGN | PRINT
                      • 36549
                      • 572 Posts
                      Now solved;
                      The original rowTpl contained the wayfinder links. As it changed to use the pdoMenu I had to swap [[+wf.link]] with [[+link]] and it all works:-)
                        www.9thwave.co.uk
                           WEB | DESIGN | PRINT