We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36931
    • 206 Posts
    Dear All,

    I configured Babel more my two language web site.
    There are some page whoch will not be translated and I would like to hidde the anglish link, when is the case.

    Do you know how to do it?

    my language menu is called like this:
    [[BabelLinks? &showUnpublished=`0` &tpl=`LanguageFlags`]]
    


    But showUnpublished=0 does not solve my problem

    Should I work on my Chunk?
    Thank [ed. note: pierrot1010 last edited this post 12 years, 5 months ago.]
      • 33968
      • 863 Posts
      I think by default the link will go back to your home page if there is no translation present.

      To hide the link you'll need to use an output modifier in your tpl chunk.

      Something like:
      [[+url:isnot=`[[!++site_url]]`:then=`
          <li><a href="[[+url]]" class="[[+cultureKey]][[+active:notempty=` [[+active]]`]]">[[%babel.language_[[+cultureKey]]? &topic=`default` &namespace=`babel`]]</a></li>
      `]]
      

      I think site_url is not the right one to use there as you need to get the other context version, but hopefully that should point you in the right direction.
        • 36931
        • 206 Posts
        Hello,
        Your are right it does not work, but you point me in a good direction because I have not thought to do it like this.
        I am gogin to try with ifEval
          • 36931
          • 206 Posts
          May you can help me again

          I am trying to compare to placeholder
          [[!ifEval?
            		&input=`[[++site_url]][[+cultureKey]]/==[[+url]]`
            		&contentTrue=`oui`
            		&contentFalse=`<a href="[[+url]]" class="[[+cultureKey]][[+active:notempty=` [[+active]]`]]">[[%babel.language_[[+cultureKey]]? &topic=`default` &namespace=`babel`]]</a>`
            	]]


          My problem is in the &input.
          How can I concatanate (merge) this :" [[++site_url]][[+cultureKey]]/ " in order to make sure that the comparaison of [[+url]] is done with the full string of " [[++site_url]][[+cultureKey]]/ " ?

          Many thank [ed. note: pierrot1010 last edited this post 12 years, 5 months ago.]
            • 36931
            • 206 Posts
            Hello, I am looking to have a pipe ( | ) between the language link. But my problem is how to do not have it after the last language link?

            Some have an idea?

            Thank

            I solved my previous issue. I did like this
            <li>
              [[!ifEval?
              	&input=`[[BabelTranslation? &contextKey=`en`]] > 0`
              	&contentTrue=`
            
            		[[!ifEval? 
              			&input=`[[+active]] == [[+active:notempty=` [[+active]]`]]` 
              			&contentTrue=`[[%babel.language_[[+cultureKey]]? &topic=`default` &namespace=`babel`]]`
              			&contentFalse=`<a href="[[+url]]" class="[[+cultureKey]][[+active:notempty=` [[+active]]`]]">[[%babel.language_[[+cultureKey]]? &topic=`default` &namespace=`babel`]]</a>` 
            		]]
             	|`
              ]]
            </li>


            And it's works!!
              • 36931
              • 206 Posts
              Hello all!
              Some has an idea in order to have a pipe between the language link but excepted after the last?

              many thank for your help
                • 3749
                • 24,544 Posts
                I'm not sure what you're trying to do (I've never used Babel), but it sounds like you need either a custom output modifier that strips the final | or a custom snippet that builds the string from an array with implode('|', $arrayName) -- unless Babel has something built-in to let you set the separator.
                  Did I help you? Buy me a beer
                  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