Jump to content

Suggestion for simpler language method in WHMCS


NadalKumar

Recommended Posts

The current language processing seems unnecessarily complex and can be simplified by using PHP parse_ini_file() method and define() each value.

$language = parse_ini_file(ROOTDIR.'/lang/'.Setting::getValue('Language').'.ini');

foreach($language as $key => $value) {
	define(strtoupper($key), $value, true);
}

The language constants and values (english.ini) would simply be written as

; navigation labels
NAV_LBL_HOME="Home"
NAV_LBL_CLIENTAREA="Clientarea"

; client area head tags
HEAD_TAG_ACCOUNT_INFO="Account Information"
HEAD_TAG_ACCOUNT_STATS="Account Statistics"

and output is simply

// tpl files
{HEAD_TAG_ACCOUNT_INFO}

// php
echo HEAD_TAG_ACCOUNT_INFO

This adds greater global usage as the constants can be used in XML, TXT and any other file type. Yes I realize it would be a massive change but isn't that what makes applications better... flowing with change.

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