Jump to content

Provisioning Module Language not working


webix

Recommended Posts

Hello Folks.

 

I am trying to make the languages on a addon that i am developping work and i can't figure out this.

 

My folder structure is this:

modules/addons/mycustomaddon/lang -> This is where i am putting the languages files.

modules/servers/mycustomaddon -> This is where i am putting my custom addon.

 

The module is working well if i hard code the english on the mycustomaddon.php file.

I am following this guide: http://docs.whmcs.com/Addon_Module_Developer_Docs#Multi-Language

 

My english.php example:

<?php
$_ADDONLANG['ModuleVersion'] = "Module Version";

 

My mycustomaddon.php:

<?php
function mycustomaddon_MetaData()
{
   return array(
       'DisplayName' => 'mycustomaddon',
       'APIVersion' => '1.1', // Use API Version 1.1
       'RequiresServer' => true, // Set true if module requires a server to work
'language' => 'english',
   );
}

function xrvteamspeak3_ConfigOptions()
{
   return array(
       'Module Version' => array(
           'FriendlyName' => $_ADDONLANG['ModuleVersion'],
           'Type' => 'text',
           'Size' => 25,
           'Default' => '1.0',
       )
   );
}
// And the file continues.

 

The problem is that the text "Module Version" doesn't show up.

Link to comment
Share on other sites

  • 1 year later...

It's a little late to answer your problem, but this information may be useful for someone else!

The language is stored in the $vars['_lang' variable, you can't access it directly from the $_ADDONLANG variable.

Therefore, in your case, you'd need to access the value like so :

$vars['_lang']['ModuleVersion']

or, you can always created yourself a shortcut like so :

 

// Language shortcut

$LANG = $vars['_lang'];

And in your code you simply use :

$LANG['ModuleVersion'];

 

I hope this can help you!

 

Sincerely,

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated