We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30223
    • 1,010 Posts
    So I’m finally starting to recode eForm for Revolution and am wondering if I should change the language handling to the new $modx->lexicon approach. While I’ve worked out some basics I do have a few questions.

    1. Is there any guideline about where to place the language (oops sorry, I mean the lexicon) files? I currently have a lexicon folder underneath my eform folder (eg. assets/snippets/eform/lexicon/en/default.inc.php) however it seems to me more efficient to have a lexicon folder directly underneath the assets directory and use sub directories for each snippet and plugin. For example /assets/lexicon/en/eform/default.inc.php.

    2. Should I use $modx->loadLexicon(); or $modx->lexicon->load(); possibly together with $modx->lexicon->addDirectory(). (timyMce uses the latter I saw and that would be my preference I think). The difference between the two has me a bit baffled. $modx->loadLexicon() has a default path of MODX_MANAGER_PATH . ’includes/lang/’ which I can’t locate anywhere but allows me to provide my own language (or culture) key. $modx->lexicon->load() on the other hand doesn’t allow me to provide a custom culture key but has the advantage of subdirs and namespacing (although I have yet to figure out all the details of lexicon namespaces )

    Edit: Turns out that providing a key to $modx->loadLexicon() doesn’t do anything useful anyway as the method uses $this->cultureKey for loading a language file regardless. I have the suspicion this function is deprecated, is it?
    • As long as new elements are added via an installer script, having a separate global lexicon directory would work. But if elements are installed manually, having support files scattered all over the file system would make things very awkward. Also, there would need to be some kind of support for editing these files besides digging through the system trying to find where the language file is to make any changes to it.
        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
      • The use of lexicon in this situation is not completed yet and will require a little additional work for the front-end to load the lexicon, which is done by the modRequest class. This is exactly the kind of developer feedback we need to find all the outstanding pieces which need to be completed. I’ll review this later this afternoon and try and finish up the core work needed to support front-end use of lexicons. It should be fairly simple to complete; right now it is only loading if the context is ’mgr’ or ’connector’.
          • 30223
          • 1,010 Posts
          Thanks Jason, I’ll stick to the old $_Lang for now and recode things later on when this is settled.