Jump to content

How to recover language variable value in php?


Remitur

Recommended Posts

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)

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • 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