Quote from: BobRay at Jan 07, 2014, 08:16 AMRight, but the OP is talking about existing MODX snippets that don't have that capability.
That said, many of those snippets (e.g. getResources) use Tpl chunk and you could put language tags in those chunks.
SimpleSearch snippet? I looked on a github page of this snippet and there is lexicons present, actually. The code:
$this->modx->lexicon->load('sisea:default');
Quote from: Sylvaticus at Jan 07, 2014, 03:44 PM
https://github.com/splittingred/SimpleSearch/blob/develop/core/components/simplesearch/model/simplesearch/simplesearch.class.php
Here. You can find this file in the same path in you MODX installation.
For language change, create a TV with language parameter (en/no) and before this line, you can add something like this:
$page = $modx->getObject('modResource', 123); // number of resource that uses this TV $lang = $page->getTVValue('lang'); // TV named 'lang' $Setting = $modx->getObject('modSystemSetting', 'cultureKey'); $Setting->set('cultureKey', $lang);
Finally, insert [[!SimpleSearch]] snippet on page Uncached.
$id = $modx->resource->get('id'); $page = $modx->getObject('modResource', $id); // number of resource that uses this TV $lang = $page->getTVValue('lang'); // TV named 'lang' $modx->setOption('cultureKey', $lang); $this->modx->lexicon->load('sisea:default');
[[!SimpleSearch &lang=`no`]]
[[!SimpleSearch &lang=`en`]]
The next thing now would be able to set this directly in the snippet-call, as:or[[!SimpleSearch &lang=`no`]]instead of via a TV.[[!SimpleSearch &lang=`en`]]
$modx->setOption('cultureKey', $lang); $this->modx->lexicon->load('sisea:default');
$lang = $modx->getOption('lang',$scriptProperties,'en');
$lang = $modx->getOption('lang',$scriptProperties,'en'); $modx->setOption('cultureKey', $lang); $this->modx->lexicon->load('sisea:default');