We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20014
    • 200 Posts
    Boy, formit is a dream, it took me about five minutes to move my eform template to that of formit, just a question though, I need formit under another language’s container to spit back error messages in a different language. I think I know how to go about it, but I need to be sure.

    I assume that I use the language in the tag as stated here:http://rtfm.modx.com/display/revolution/Internationalization and create a translation to two of the three docs in fomit’s lexicon folder (core/formit/lexicon)?

    Also, straying away from formit, I noticed no Spanish in the Lexicon management, which I find odd being that it is the most widely spoken language in the western hemisphere. If I wanted to add a translation to the whole core would I go to core/lexicon choose the english folder and translate the 41 docs there? I believe this would be for the revo installation only and not formit, that would still need the formit specific translation correct?

    EDIT: translated files, in manager found how to change the lexicon for formit, will come back null if characters have accents etc ie (ñ, ó) am trying to figure out how to assign it to that one specific call of formit in the container. will report back.
    oh by the way, I fiddled with the class key of the resource, change the name, it disappeared from the tree, is it gone? I created a new one in about two seconds, just wondering if it is still floating about in the db or where I can permanently delete it.
      • 20014
      • 200 Posts
      nope still can’t get it to work yet, have not made a translation for the core lexicon, and don’t know how to make the specific call for formit in my language container pull the translation I made in formit’s own lexicon folder.
        • 20014
        • 200 Posts
        ok, this is the deal, in evo I set two containers with redirect snippets to home pages of each lang,
        after researching some things I found this:http://www.h-quadrat.com/techblog/111-modx-revolution-multi-domain-context-installation-english.php
        still have to read it more closely, but I am under the assumption that I create a new context which will now act as the container for my other language resources and then have all links pointing to the other language point to home page under the new context?

        this means I will have to translate the core lexicon files and assign it to the whole context and have one language for the web context and another for the second context? ok, it’s saturday and I finished for today, but if anyone can clue me in, that would be awesome!

        In the end I don’t think I really need another "site", unless this is the only way to do things now, just the ability to translate specific things such as formit and simple search results.
          • 7806
          • 45 Posts
          Have you tried to clear the cache? Worked for me.

          Jörg
            • 20014
            • 200 Posts
            yes, actually I am not sure if I call &language in the snippet itself, create a context and call it using the key, or if I need to even create a context in the first place. I am searching like heck to see if I can make formit use the spanish lexicon translation I created without the need of creating a context...so far no luck.

            Donalbain, I see you did a german translation of the errors, I assume you have a multi-language site or is it German only? If you do have a multi-language site, how did you get formit to respond in English (or the language you provided on your site) in one resource container and then German in another? was that a link to your blog that I had posted?
              • 3894
              • 15 Posts
              I encountered the same problem and I have found 2 ways to solve it:

              1. Set the "cultureKey" option of the web context to the prefered language ("nl" in my case). This is the easiest solution. The big drawback to this solution is that it can only be set for the whole context. Depending on your site, this may or may not be a good solution. This can be done via the Manager in a few steps:


              • Choose System -> Contexts form the manager menu
              • Right click the "web" context line and choose "Update"
              • Switch to the "Context Settings" tab
              • Click the "Create New" button
              • Fill in the form, make sure that the "Key" field is set to "cultureKey". The "Value" field should contain your language code ("nl" in my case).
              • Click the "Save" button to save the setting.
              • Empty the site cache (just to be sure).
              • The validation messages should now appear in the chosen language.

              Note: It is needless to say that there must be a translation for your language in FormIt.


              2. Change FormIt so that you can pass in a language parameter. For this to work you need to edit the model/formit/formit.class.php file inside the formit component. The initialize method chould be changed like this:

              From:
                  public function initialize($context = 'web') {
                      switch ($context) {
                          case 'mgr': break;
                          case 'web':
                          default:
                              $this->modx->lexicon->load('formit:default');
                              $this->_initialized = true;
                              break;
                      }
                      return $this->_initialized;
                  }
              


              To:
                  public function initialize($context = 'web') {
                      switch ($context) {
                          case 'mgr': break;
                          case 'web':
                          default:
                              $language = isset($this->config['language']) ? $this->config['language'] . ':' : '';
                              $this->modx->lexicon->load($language . 'formit:default');
                              $this->_initialized = true;
                              break;
                      }
                      return $this->_initialized;
                  }
              


              The drawback to this solution is that the changes may be overwritten when FormIt is going to be updated. Maybe this solution can be integrated in the default FormIt package..
                • 3749
                • 24,544 Posts

                FYI, this should load a language-specific set of entries.

                $modx->lexicon->load('language:namespace:topic');


                Would it be possible for you to write a snippet that checks the language setting and loads the appropriate language strings (or has a language parameter if you’re using different form pages)? You could put the snippet tag just above the FormIt tag and just comment out the lexicon->load line in FormIt.

                I’ve never tried it so I’m not sure if it makes sense or not for your situation.
                  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
                  • 31640
                  • 100 Posts
                  Maybe this can be an enhancement request for the next version of formIt

                  I really like this snippet.
                  But changing the class file isn’t a good idea i think smiley
                  and i need to do this to change the language to dutch so....
                    • 28215
                    • 4,149 Posts
                    Can you file it as a feature request here: http://github.com/splittingred/FormIt/issues ?
                      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                      • 22539
                      • 5 Posts
                      I managed to get it work. If from Holland, so i needed the dutch translations.
                      Tried al lot of things, but nothing worked, so i went searching in every folder on the site and i found it:

                      /core/cache/lexicon/en/default.cache.php

                      Here are the englisch error lines, which i replaces with the dutch ones (/core/components/formit/lexicon/nl)

                      There probebly are easier methods, but this one worked for me.