Remitur Posted August 19, 2019 Share Posted August 19, 2019 Hello. Having defined some language variable, i.e. $_LANG['mylangvariable'] = "This is my language variable"; how can I recover the value of $_LANG['mylanguagevariable'] to use it in a php hook?! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 19, 2019 Share Posted August 19, 2019 (edited) 3 minutes ago, Remitur said: how can I recover the value of $_LANG['mylanguagevariable'] to use it in a php hook?! the usual way would be Lang::trans('mylanguagevariable') Edited August 19, 2019 by brian! 0 Quote Link to comment Share on other sites More sharing options...
Remitur Posted August 19, 2019 Author Share Posted August 19, 2019 6 minutes ago, brian! said: the usual way would be Lang::trans('mylanguagevariable') Yes, but does exist any way to recover directly the variable? My previous example was not properly chosen, let's say I need to recover a language array, as: $_LANG['mylanguagevariable'] ['first']="aaaa"; $_LANG['mylanguagevariable'] ['second']="bbbbb"; It it somehow possible to recover the whole array $LANG['mylanguagevariable'] ? (a very dirty way, not tested by I guess it should works, would be a require, i,.e. require('lang/override/' . $language . '.php'); .... but it's a very dirty way to do it, and don't know if it may bring with some kind of issue with WHMCS core) 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 19, 2019 Share Posted August 19, 2019 25 minutes ago, Remitur said: Yes, but does exist any way to recover directly the variable? declare the variable globally - then you can reference any element of it in the hook. so in the above example, i'm using a hook to effectively override a language string - in your case, declare $_LANG globally, then you can access it as you can with any other array. 1 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.