Author Topic: How do I include a NEW language file in VM?  (Read 4581 times)

akerman

  • Jr. Member
  • **
  • Posts: 325
  • Knowledge weighs Nothing!
    • STOLT/AKERMAN
How do I include a NEW language file in VM?
« on: October 17, 2008, 09:33:28 am »
Hi,

read the forum and the development material for a day now without finding any conclusive answer, so I post here.

Background:
1. I've developed a module that I want to insert into VM.
2. With the module there are some language parameters.
3. The parameters are specified in a separate file in the module package.
4. When installing the module I want the language file to land in the VM language
   directories. (This I solve thru the normal XML script during module install in Joomla!)

Issue:

1. The NEW language for the module must be included in VM language structure.
     That is, VM must include it in the language class file.
2. When inserting the modules language file (that follows the VM structure), it is NOT read.

Questions:
1. Can't VM work with new files included in the language directories?
2. Is VM 'locked' to only use the existing language files?
3. If it is possible to insert new language files, then how do I do?

Important to understand:

1. I do NOT want to hack existing VM language files
2. I'm NOT looking to create or replace existing VM language files


Reflection:
If the answer is that VM is locked for new additions in the language file directory, then I perceive it as a problem for third parties to develop new features for VM. And possibly something that would need to be changed for the future.

Regards
Akerman

http://STOLT-AKERMAN.com - Web & Design agency. Spemildt in e-shop, ecommerce and marketing.
http://InfoClip.se - Swedish Antique & Used Books & Art Shop.
http://AkermansCove - Personal Portfolio
Ubuntu LAMP / Joomla 1.5.22 / VM 1.1.6 / JoomFish Contributor / Developer / Designer

Erik P

  • Jr. Member
  • **
  • Posts: 114
Re: How do I include a NEW language file in VM?
« Reply #1 on: October 24, 2008, 17:54:06 pm »
You can find the answer in classes/language.class.php. The method load() will load the file:
ADMINPATH. 'languages/'.$module.'/'.strtolower($mosConfig_lang).'.php'

But this will be done transparently by the method _($var). However, it looks at the global variable called $modulename, checks if the language file for that module is already loaded and if not, it loads it.

So, before using the $VM_LANG->_($var) method, you must first initialize the variable $modulename to your module name. Otherwise, your module's language file will not be loaded at first use of it.
http://sankuru.biz. Software services. Customizing and fixing Virtuemart installations.

akerman

  • Jr. Member
  • **
  • Posts: 325
  • Knowledge weighs Nothing!
    • STOLT/AKERMAN
Re: How do I include a NEW language file in VM?
« Reply #2 on: October 26, 2008, 21:12:17 pm »
Hi,

thank you. I will try this. It wasn't that obvious or easy to find.

Regards
Akerman
http://STOLT-AKERMAN.com - Web & Design agency. Spemildt in e-shop, ecommerce and marketing.
http://InfoClip.se - Swedish Antique & Used Books & Art Shop.
http://AkermansCove - Personal Portfolio
Ubuntu LAMP / Joomla 1.5.22 / VM 1.1.6 / JoomFish Contributor / Developer / Designer