Jump to content

Having some trouble with translations in a hook


sherwin_flight

Recommended Posts

I am developing an addon module, and it also uses a hooks.php file.

 

I have two hooks: AdminAreaFooterOutput and AdminAreaHeadOutput.

 

My module also includes a lang/english.php file, and I have that working for the main part of my module, now i need to get it working for the hooks file.

 

I have searched the forums and have found many posts relating to the use of Lang::trans. However, in pretty much all cases it says the language string needs to be added to the Language Overrides files.

 

Since this is a module, I'd like it to work without needing any modifications to the main language overrides files. I would rather use the language files distributed with my module for this purpose.

 

So how can I use the text strings from my module/lang/ folder in my hooks.php file?

Link to comment
Share on other sites

So I have a partial answer so far.

 

I have this code:

 

include "lang/english.php";

foreach ($_ADDONLANG as $key => $value) {

$LANG[$key] = $value;

}

 

That reads the language file, and creates variables in the exact same format that are used in other places in a module.

 

I just need to know a way to access the currently logged in admin's language. using {debug} in the admin area, it shows a variable "$adminLanguage" but for some reason I can't get that variable into the PHP code of my hooks.php file.

 

Any ideas?

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.

×
×
  • 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