Jump to content

Language overrides


REX

Recommended Posts

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.

 

Link to comment
Share on other sites

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 ?  

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.).

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