We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 12508
    • 63 Posts
    Description of Problem:
    I can't change the language for SimpleSearch results list.

    Steps to Reproduce:
    Just searching something in our german website.

    Expected Outcome:
    I would like to change the default texts like:
    "X Results found for..."
    or
    "Result pages:..."
    into german.

    I know SimpleSearch has a lexicon installed which already has the right translations. But I can't find the way to choose it.

    I appreciate your help in advance.


    • MODX Version:
    • MODX Revolution 2.2.10-pl (traditional)
    • PHP Version:
    • 5.4.6
    • Database (MySQL, SQL Server, etc) Version:
    • mysql v. 5.5.20
    • Installed MODX Add-ons:
    • - getResourceField
      - getResources
      - SimpleSearch
      - TinyMCE
      - UltimateParent
      - Wayfinder
    • Error Log Contents: (attach as file if it’s too large)
    • No errors displayed on Log.
      • 42562
      • 1,145 Posts
      Yes it has en, de, fr, nl and ru preinstalled.
      I don't know if SimpleSearch has a &language=`` feature, but I think it might work automatically if you altered the language setting of your Context to one of your choosing.

      To do this manually though, go to System -> Lexicon Management ->
      Namespace: sisea (don't ask me why it's called this and not SimpleSearch)
      Topic: default
      Filter: results or whatever
        TinymceWrapper: Complete back/frontend content solution.
        Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
        5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
        • 12508
        • 63 Posts
        Thank you donshakespeare for your post.

        Yes, I can find all the right translations on System -> Lexicon Management etc.
        And yes, as far as I understand, sisea has a &language= feature.
        I found that in the i18n Documentation:
        http://rtfm.modx.com/revolution/2.x/developing-in-modx/advanced-development/internationalization

        To use a Lexicon Entry in a tag, use the following syntax:
        [[%key? 
        	&topic=`topicname`
        	&namespace=`namespace_name`
        	&language=`en`
        ]]


        So, that is what I did in my sisea tag:

        [[!SimpleSearch?
            &namespace=`sisea`
            &topic=`default`
            &language=`de`
        ]]


        Sadly it continues displaying the result texts in english, not german.
          • 42562
          • 1,145 Posts
          Better still, manually edit the namespace if your entire site is German.

          REPLACE [[+count]] Results found for "[[+text]]"

          WITH [[+count]] Ergebnis(se) für "[[+text]]" gefunden

          To find this
          go to System -> Lexicon Management ->
          Namespace: sisea
          Topic: default
          Filter: results
            TinymceWrapper: Complete back/frontend content solution.
            Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
            5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
            • 12508
            • 63 Posts
            donshakespeare,

            our website is in 3 languages, English German and French. We are using only 1 Context for all 3 Languages. I know it would be easer to use a context for each language.

            Our solution could be to force simplesearch to use the lexicon according to the language that is in use. Each language is using its own search form:

            English:
            [[!SimpleSearch?
                &namespace=`sisea`
                &topic=`default`
                &language=`en`
            ]]


            German:
            [[!SimpleSearch?
                &namespace=`sisea`
                &topic=`default`
                &language=`de`
            ]]


            French:
            [[!SimpleSearch?
                &namespace=`sisea`
                &topic=`default`
                &language=`fr`
            ]]


            For the default language it is easy by changing the namespace, (as you propose), but for the rest could be great if
            &language=``
            could work.

            Any ideas?

            Thank you for your support.
              • 42562
              • 1,145 Posts
              So since these are mere namespaces, I'd attack the code that calls them.
              Since SimpleSearch has a container tpl, create your own tpls, one for each of your three SimpleSearch calls.

              http://rtfm.modx.com/extras/revo/simplesearch/simplesearch.simplesearch/simplesearch.simplesearch.containertpl
              [[!SimpleSearch? &containerTpl=`english`]]
              [[!SimpleSearch? &containerTpl=`german`]]
              [[!SimpleSearch? &containerTpl=`french`]]

              containerTpl
              <p class="sisea-results">[[+resultInfo]]</p>
               
              <div class="sisea-paging"><span class="sisea-result-pages">[[%sisea.result_pages? &namespace=`sisea` &topic=`default`]]</span>[[+paging]]</div>
               
              <div class="sisea-results-list">
                  [[+results]]
              </div>
               
              <div class="sisea-paging"><span class="sisea-result-pages">[[%sisea.result_pages? &namespace=`sisea` &topic=`default`]]</span>[[+paging]]</div>

              You can even replace [[%sisea.result_pages? &namespace=`sisea` &topic=`default`]] with your own actual words.

              See if this works.
                TinymceWrapper: Complete back/frontend content solution.
                Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                • 12508
                • 63 Posts
                donshakespeare,

                it is a good idea but there is a small problem. A template for each language works with "sisea-paging"; but not the [[+resultInfo]]. It comes with the default language.

                Here my template in french:

                <p class="sisea-results">[[+resultInfo]]</p>
                 
                <div class="sisea-paging">
                    <span class="sisea-result-pages">[[%sisea.result_pages? &namespace=`sisea` &topic=`default` &language=`fr`]]</span>[[+paging]]
                </div>
                 
                <div class="sisea-results-list">
                    [[+results]]
                </div>
                 
                <div class="sisea-paging">
                    <span class="sisea-result-pages">[[%sisea.result_pages? &namespace=`sisea` &topic=`default` &language=`fr`]]</span>[[+paging]]
                </div>
                


                If I change the:
                <p class="sisea-results">[[+resultInfo]]</p>


                For this:
                <p class="sisea-results">[[+count]] résultat(s) trouvé(s) pour «[[+text]]»</p>

                I will not work, I can't get the [[+cont]] nor the [[+text]]. They come with empty values.

                Any ideas about how to add a variable for each language to the [[+resultInfo]] tag? Or other way to solve the problem?

                Thanks again for your support.
                  • 42562
                  • 1,145 Posts
                    TinymceWrapper: Complete back/frontend content solution.
                    Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
                    5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
                    • 2396
                    • 101 Posts
                    Quote from: hvillega at Dec 20, 2013, 10:07 AM

                    <p class="sisea-results">[[+count]] résultat(s) trouvé(s) pour «[[+text]]»</p>

                    I will not work, I can't get the [[+cont]] nor the [[+text]]. They come with empty values.

                    I believe the placeholders you need to use are [[+total]] and [[+query]], not [[+count]] and [[+text]]. Have you tried:
                    <p class="sisea-results">[[+total]] résultat(s) trouvé(s) pour «[[+query]]»</p>
                    
                    <div class="sisea-paging"><span class="sisea-result-pages">Pages de résultats </span>[[+paging]]</div>
                    
                    <div class="sisea-results-list">
                        [[+results]]
                    </div>
                    
                    <div class="sisea-paging"><span class="sisea-result-pages">Pages de résultats </span>[[+paging]]</div>


                    My French is shaky at best but I think that's what you're trying to do - I had to hack the results form for Chinese results (I have no idea about Chinese) and these placeholders work perfectly.
                      • 12508
                      • 63 Posts
                      Hey atype. It works the way you describe.

                      Thank you very much for your help!.