We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • @rajciok and @antzone,
    the option to switch language while editing document doesnt occur
    I'm guessing that you have incorrect setting.
    Please check the documentation again, I've added more documentation recently.

    If the problem persists, please post on my github account.
      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.
    • Just installed this, and I am impressed.

      Now to play with it and see how to work with extras like Gallery!
        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
        • 46359
        • 4 Posts
        Best multilanguage solution for MODx ever! Congrats! I haven't fixed the problem with CK Editor yet.. If I do, I will post the solution here! smiley

        Greetings and very very big thanks for this plugin! Great job! [ed. note: rajciok last edited this post 9 years, 6 months ago.]
          • 46359
          • 4 Posts
          Hello everyone, hello @glodsky!

          I haven't found the solution to CFK Editor yet, honestly - I've not been even looking for it yet :/ BUT:

          I found a little bug but very annoying. I had a problem with lingua.getValue snippet. It works great on it's own and get all TV's values well. But if used with getResources from inside a tpl Chunk it does not get (or output) the right value of Template Variables and uses the default value. And I have to notice that I took care of these with getResources:

          • &includeTVs=`1`
          • &processTVs=`1`

          And now my example:
          This the line wich should display the right link to an image according to the language key:
          <img src="[[lingua.getValue:default=`[[+art.image]]`? &id=`[[+id]]` &field=`art.image`]]" />

          But it doesn't work inside getResources. All standard fields language is switching right - content, pagetitle, etc.
          From within this template:
          <img src="[[lingua.getValue:default=`[[*art.image]]`? &id=`[[*id]]` &field=`art.image`]]" />

          it works great.

          So I decided to look inside the snippet code, although I'm rather a poor backend developer smiley And I did some experiments with lingua.getValue:

          Original code:
          // try TV
          else {
              $tv = $modx->getObject('modTemplateVar', array(
                  'name' => $field,
              ));
              if ($tv) {
                  $linguaSiteTmplvarContentvalues = $modx->getObject('linguaSiteTmplvarContentvalues', array(
                      'lang_id' => $langObj->get('id'),
                      'tmplvarid' => $tv->get('id'),
                      'contentid' => $id,
                  ));
                  if ($linguaSiteTmplvarContentvalues) {
                      $value = $linguaSiteTmplvarContentvalues->get('value');
                      $tv->setValue($tv->get('id'), $value);
                  }
                  $output = $tv->renderOutput($resource->get('id'));
              }
          }


          And the code after makeovers:
          // try TV
          else {
              $tv = $modx->getObject('modTemplateVar', array(
                  'name' => $field,
              ));
              if ($tv) {
                  $linguaSiteTmplvarContentvalues = $modx->getObject('linguaSiteTmplvarContentvalues', array(
                      'lang_id' => $langObj->get('id'),
                      'tmplvarid' => $tv->get('id'),
                      'contentid' => $id,
                  ));
                  if ($linguaSiteTmplvarContentvalues) {
                      $value = $linguaSiteTmplvarContentvalues->get('value');
                      // $tv->setValue($tv->get('id'), $value);
                  }
                  // $output = $tv->renderOutput($resource->get('id'));
                  $output = $value;
              }
          }

          I've just commented out two lines and instead of rendering the TV just outputing the found right value. And it started to work poroprerly. I'm not an expert so I hope the author will improve the code. Meanwhile you can use this solution if you cope with the same problem I did.

          Greetings [ed. note: rajciok last edited this post 9 years, 5 months ago.]
            • 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.
              • 22448
              • 241 Posts
              Got another interesting issue with using Lingua.

              I'm importing resources and their tvs, including the ones that need translations, through importX.
              Is there a way to make Lingua to go through the imported resources in batch in order to replicate the imported content into its own tables.
              Currently it appears that the only way to do that is to go back and save imported pages manually one by one which is not a good solution.

              Thanks in advance.

              • If they are not translated, the other languages are supposed to take the default/original values.
                Aren't they taking them?
                  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.
                  • 22448
                  • 241 Posts
                  Yes they are but that's not the issue.

                  After the initial import with ImportX the resources exist in the modx_site_content and in template variables tables because the default language values were included in the import.

                  At this point i'd like to update just the translated values in lingua tables but the newly imported resources don't exist there yet. They are only copied after a resource is edited in the manager and saved. I'm wondering if there's a way to make lingua pickup the newly imported resources in batch and insert them into its tables. At which point i could do a simple sql update to save the translated values.

                  Thanks.

                  • Quote from: outre99 at Dec 08, 2014, 02:32 PM

                    Yes they are but that's not the issue.

                    After the initial import with ImportX the resources exist in the modx_site_content and in template variables tables because the default language values were included in the import.

                    At this point i'd like to update just the translated values in lingua tables but the newly imported resources don't exist there yet. They are only copied after a resource is edited in the manager and saved. I'm wondering if there's a way to make lingua pickup the newly imported resources in batch and insert them into its tables. At which point i could do a simple sql update to save the translated values.

                    Thanks.


                    Frankly speaking, this is not a part of the Lingua's core feature, or even will be in roadmap, because this is beyond the basic idea and general usage of Lingua.
                    And moreover, if this is part of the importing task, then it's ImportX that needs to change.
                    But I can give commercial support for specific needs like this if you like to.
                      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.
                      • 22448
                      • 241 Posts
                      ImportX is not and cannot be aware of Lingua since it can be used with our without it. It does what it does pretty well with some idiosyncrasies.

                      The recent version of Lingua is replicating data from the site-content table. I'm sure there were good reasons to do that but it does create issues including the one i mentioned. Lingua plugin is tied to a page save event and inserts resource values and translations into its own tables. All i'm asking is to be able to run this same logic in batch. I've tried to trigger the page save event with batcher but that didn't work.

                      Assuming that the content will always be manually entered into sites using Lingua is not viable. This is especially true for sites being migrated to MODx.