webix Posted January 20, 2017 Share Posted January 20, 2017 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. 1 Link to comment Share on other sites More sharing options...
Neutrall Posted January 24, 2018 Share Posted January 24, 2018 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 More sharing options...
Recommended Posts