[TYPO3-dev] getting at locallang_db.php in an FE plugin
Markus bertheau
mbertheau.typo3 at gmail.com
Mon Apr 10 13:12:54 CEST 2006
Hmm, interesting. Doesn't work though (am still getting empty
strings), and while debugging the debugger couldn't find class
language, so I stayed with a bad hack
(http://wiki.typo3.org/index.php/Locallang_db.php_in_FE )
Thanks
Markus
2006/4/10, Bernd Wilke <xoonsji02 at sneakemail.com>:
> On Mon, 10 Apr 2006 15:02:51 +0700, Markus bertheau wrote
> with subject "[TYPO3-dev] getting at locallang_db.php in an FE plugin":
>
> > Hi,
> >
> > how would I get at the values in the $LOCAL_LANG array from
> > locallang_db.php in a frontend plugin? It seems locallang_db.php does
> > not get loaded for the frontend; so pi_getLL() returns an empty
> > string.
>
> a little bit complex on the first sight:
>
> insert/update/verify the following lines in your extension-class:
> (positions as given in your file, numbers as your work-flow)
>
>
> 1. require_once(t3lib_extMgm::extPath('lang').'lang.php')
>
> class tx_... extends tslib_pibase {
>
> 2. var $LL //array with locallang-values
> var $LANG // object to access $LL
> // 'global $LANG' should be enough, but failed
>
> function main($content,$conf) {
>
> 3. $this->LL = $this->includeLocalLang(); // load external locallang
> $this->LANG = t3lib_dev::makeInstance('language'); // create
> // language-object
> $LLkey='default';
> if ($GLOBALS['TSFE']->config['config']['language']) {
> $LLkey = $GLOBALS['TSFE']->config['config']['language'];
> }
> $this->LANG->init($LLkey) // initalize language-object
> // with actual language
>
>
> 6. $text = $this->my_getLL('key');
>
> }
>
> 4. function includeLocalLang() {
> // get path to desired locallang
> include(t3lib_dev::extPath($extkey).'locallang_DB.php');
> return $LOCAL_LANG;
> }
>
> 5. function my_getLL($k,$alt='',$hsc=true) {
> $retval=$this->pi_getLL($k,'',$hsc);
> if (!$retval) $retval = $this->LANG->getLLL($k,$this->LL,$hsc);
> if (!$retval) $retval=$alt;
> return $retval;
> }
> }
>
>
> good luck
> Bernd
>
> --
> ----------------
> Bernd Wilke
> Annweilerstr.20
> 40229 Düsseldorf
> 0211/229 2800
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
>
More information about the TYPO3-dev
mailing list