using language files of other modules

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
jeroendelau

using language files of other modules

Post 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
Dee
Power Poster
Power Poster
Posts: 1197
Joined: Sun Mar 19, 2006 8:46 pm
Location: the Netherlands

Re: using language files of other modules

Post 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
jeroendelau

Re: using language files of other modules

Post by jeroendelau »

thnx, that did the trick!

Jeroen
Locked

Return to “Modules/Add-Ons”