Page 1 of 1

using language files of other modules

Posted: Mon Mar 12, 2007 9:40 am
by jeroendelau
I'm having a problem with the languages.

I'm developing two modules, one is the foundation it contains a lot of classes I want to reuse. These classes also handle some output so I include some $module->Lang(_) statements. Where $module is the current active module.

This works fine when testing in the foundation module. The en_US contains all the translations for this module. However once I start using the classes from the foundation modules from other modules the lang() function will no longer see the translation from the foundation module file.

I don't want to copy the foundation translations into every module I want to use it in. Is there a way to reference the translations from the foundation class in a absolute way?

Rephrase: Can you access the language array from module B from module A

Much appreciated,
Jeroen

Re: using language files of other modules

Posted: Mon Mar 12, 2007 10:03 am
by Dee
From your second module you can use either

Code: Select all

$modA =& $this->cms->modules['ModuleA']['object'];
or

Code: Select all

$modA =& $this->getModuleInstance('ModuleA');
to get a reference to the other module object.
You should then be able to call $modA->Lang('langstr');

Regards,
D

Re: using language files of other modules

Posted: Mon Mar 12, 2007 3:19 pm
by jeroendelau
thnx, that did the trick!

Jeroen