We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 50312
    • 34 Posts
    I would like to use Archivist and getArchives, which both should take the new (thanks to Bruno for linguaPdoTools!) language specific setup into account.

    How can I teach Archivist to generate a menu based on the available resources for the selected language?
    Right now my Archivist generated menu looks like this:

    2015 (5) | 2014 (15) | 2013 (17) | 2012 (10)

    The numbers in brackets are counting the resources for that year, via the Archivist-placeholder [[+count]]
    Right now these Numbers don't change. Advice from Bruno: Use the &where filter and pass the IDs of the current language to it. Get the IDs via pdoResources or write a small custom Snippet.

    I have no clue which field to run that filter on? &where=`{"how-do-i-get-this-field?":"id-of-language"}`
    According to the doc's this is how one could get the ID of the current language: [[!lingua.getField? &field=`id`]]

    --------------------

    How to use getArchives (thanks to Bruno for the advice)

    getArchives calls getResources internally. So you would want to add the parameter &grSnippet with a value of pdoResources, as well as the other parameters. A complete getArchives call could then look like this:

    [[!getArchives?
    &parents=`123`
    &tpl=`YourTemplateName`
    &grSnippet=`pdoResources`
    &includeTVs=`lang_published`
    &where=`{"TVlang_published.value":"1"}`

    ]]
      • 4172
      • 5,888 Posts
      something like that seems to work:

      [[!pdoResources? 
      &includeTVs=`lang_published`
      &where=`{"TVlang_published.value":"1"}`
      &parents=`0`
      &tpl=`@INLINE [[+id]]`
      &outputSeparator=`,`
      &toPlaceholder=`translated_ids`
      ]]
      
      debug the output: [[+translated_ids]]
      
      [[!Archivist? 
      &parents=`0,0` 
      &target=`[[*id]]`
      &where=`{"id:IN":[ [[+translated_ids]] ]}`
      ]]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 50312
        • 34 Posts
        Wow, thank you very much! Works great! I gotta spend some time understanding what is actually going on there..
          • 4172
          • 5,888 Posts
          Great!

          So, if anyone is interested in the whole setup, read about it here:
          https://github.com/Bruno17/linguaPdoTools/blob/master/README.md

          pdoMenu, pdoResources and Archivist does only list translated into the current language (marked with a TV) Resources.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 50312
            • 34 Posts
            Archivist seems to ignore the &limit parameter.. I've tried everything from 0 to 999, but my output gets limited to 10, no matter what I do. Has this something to do with linguaPdoTools?
              • 4172
              • 5,888 Posts
              did you have the &limit also at the pdoResources-call?
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 50312
                • 34 Posts
                no... thank you!
                  • 50693
                  • 1 Posts
                  Hey @goldsky,

                  i have fresh modx 2.3.5 installation with lingua (2.1.0-beta4) plugin and FURLs enabled. I created template with [[!lingua.selector]], added new language and created new document with differently aliases: kontakt.html & contact.html, but the second one does not work (page redirects to home-page). There is something that i must configure on my site?

                  Thanks for help!

                  PS. Sorry for my english wink
                    • 11055 ☆ A M B ☆
                    • 3,112 Posts
                    have you set the context's settings?
                    https://rtfm.modx.com/extras/revo/lingua
                    in Editing the Context part
                      Rico
                      Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
                      MODx is great, but knowing how to use it well makes it perfect!

                      www.virtudraft.com

                      Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

                      Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

                      Maintainter/contributor of Babel

                      Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
                      • 49631
                      • 7 Posts
                      adrian.demleitner Reply #70, 11 years ago
                      Hi there

                      We're a huge fan of lingua at my company. So we tried something unusual. We hacked into the plugin so that it produces xliffs, which are automaticaly uploaded to crowdin. And if they are ready translated, they are automaticaly fetched and we can use the translations on the site.

                      We use lingua mainly for the backend management and we actually hoped it would handle translated friendly urls and translated link generation. Now I saw that lingua generates links with just the language in the query but not as a furl. Did we break that feature or did it not exist in the first place?

                      Yours, Adrian