REX Posted August 29, 2018 Share Posted August 29, 2018 Hi, I started recently working on adjusting a WHMCS module and have a question about the language override structure which is raising some questionmarks at this point. Hope someone could help me out in explaining this one. Language overrides are done in the /lang/overrides/ folder as well as in the /modules/addon/*modulename*/lang/ folder. I have a question about both which so far I have not been able to answer myself. 1. Are the values in the /lang/overrides/ $_LANG array indexed and stored in the database somewhere, or are these values overwritten and lost in the event another package also includes a translation file in that same language? 2. I'm encountering a problem where a value in $_LANG in /modules/addon/*modulename*/lang/ does not get passed on to the client environment of WHMCS. Only the admin environment. Is this a well considered seperation of translation for the customer and admin environments, or should this normally work? Is there any documentation about best practises about this subject? Thanks in advance for any response. 0 Quote Link to comment Share on other sites More sharing options...
Remitur Posted August 29, 2018 Share Posted August 29, 2018 3 hours ago, REX said: . Are the values in the /lang/overrides/ $_LANG array indexed and stored in the database somewhere, or are these values overwritten and lost in the event another package also includes a translation file in that same language? The second one is right. 3 hours ago, REX said: Language overrides are done in the /lang/overrides/ folder as well as in the /modules/addon/*modulename*/lang/ folder. I guess you can create also /modules/addon/*modulename*/lang/overrides/ folder ... 3 hours ago, REX said: 2. I'm encountering a problem where a value in $_LANG in /modules/addon/*modulename*/lang/ does not get passed on to the client environment of WHMCS. Only the admin environment. Is this a well considered seperation of translation for the customer and admin environments, or should this normally work? many add-on modules have different set of language variables for admin and client area: maybe you edited only the one for admin area, but not the one for client area ? 0 Quote Link to comment Share on other sites More sharing options...
nasos75 Posted September 1, 2018 Share Posted September 1, 2018 You should use $_ADDONLANG['key'] = value in addon/lang files, only for addons. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted September 1, 2018 Share Posted September 1, 2018 On 29 agosto 2018 at 10:32 AM, REX said: 2. I'm encountering a problem where a value in $_LANG in /modules/addon/*modulename*/lang/ does not get passed on to the client environment of WHMCS. Only the admin environment. Is this a well considered seperation of translation for the customer and admin environments, or should this normally work? Like @nasos75 said you have to use $_ADDONLANG variables. Don't forget that modules/addons/{yourmodule}/lang is available only in clientarea pages of the same module (eg. index.php?m={yourmodule}). If you want to use them in other places you have to initialize your language variables manually. 1 Quote Link to comment Share on other sites More sharing options...
REX Posted September 3, 2018 Author Share Posted September 3, 2018 Thanks everyone for the responses. On 1/09/2018 at 12:14 PM, Kian said: Like @nasos75 said you have to use $_ADDONLANG variables. Don't forget that modules/addons/{yourmodule}/lang is available only in clientarea pages of the same module (eg. index.php?m={yourmodule}). If you want to use them in other places you have to initialize your language variables manually. I can manually get values from an addon language file? How would I do that? 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted September 4, 2018 Share Posted September 4, 2018 In the boring way... <?php // In clientarea Action Hook... require('modules/addons/' . $yourmodule . '/lang/' . $language . '.php'); // ... so that now you can return $_ADDONLANG and use your lang variables But you should also prepare for fallbacks (eg. if file_exists(), default language etc.). 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.