Jump to content

Language Fallback - Feature Missing!


zstergios

Recommended Posts

A very important feature is missing from WHMCS, the language fallback. It's impossible to able to translate all custom stings to all languages, so best scenario is to load the default string translation, for example "english".

 

This is the hook code of "languageFallback.php", the code seems OK but does not effect the loaded language. Any suggestion?

 

/*
Developer: Stergios Zgouletas
Web-site: web-expert.gr
License: GNU GPL v2
*/
if(!defined("WHMCS")) die("This file cannot be accessed directly");
function languageFallback($vars){
$defaultLanguage='english'; //Fallback Language
$currentLanguage=strtolower($vars['language']); //Current Active Language
global $_LANG;

$current=$_LANG;
if($defaultLanguage!=$currentLanguage){
	//Load default language file
	$default=array();
	if(file_exists(ROOTDIR.'/lang/'.$defaultLanguage.'.php')){
		require(ROOTDIR.'/lang/'.$defaultLanguage.'.php');
		$default=$_LANG;
	}

	//Load default override language file
	$defaultOverride=array();
	if(file_exists(ROOTDIR.'/lang/overrides/'.$defaultLanguage.'.php')){
		require(ROOTDIR.'/lang/overrides/'.$defaultLanguage.'.php');
		$defaultOverride=$_LANG;
	}

	//Load module's language
	$module=array();
	if(isset($_REQUEST['m']) && !empty($_REQUEST['m']) && file_exists(ROOTDIR.'/modules/addons/'.$_REQUEST['m'].'/'.$defaultLanguage.'.php')){
		require(ROOTDIR.'/modules/addons/'.$_REQUEST['m'].'/'.$defaultLanguage.'.php');
		$module=$_ADDONLANG;
	}
	$_LANG=array_merge($default,$defaultOverride,$module,$current);
	return array('languageFallback'=>1);
}
return array('languageFallback'=>0);
}
add_hook("ClientAreaPage",0,"languageFallback");

Edited by zstergios
misstyped Request
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