Jump to content

How to add additional Simplified Chinese language at WHMCS 7


machiasiaweb

Recommended Posts

Hello,

 

I would like to add additional language at WHMCS 7 with reference URL but got problem.

 

https://developers.whmcs.com/languages/adding-a-language/

 

with Chinese translation

https://phptrends.com/dig_in/whmcs-chinese

 

However, after added then I find the language selection is not a correct ordering.

 

Example: When I choose English and to go to Simplified Chinese language page.

 

Could anyone can advise?

 

Also another question is where I can get the WHMCS 7 Simplified Chinese language pack?

 

Thanks!

Link to comment
Share on other sites

Hello,

 

It fixed now by I copy the language file to new one and the modify its contents including locale setting.

 

E.g cp english.php m_english.php

 

However, I have new question.

 

How to display in the selection list with new language name? coz now just like two 'English' can be select.

 

Thanks!

Link to comment
Share on other sites

It fixed now by I copy the language file to new one and the modify its contents including locale setting.

E.g cp english.php m_english.php

However, I have new question.

How to display in the selection list with new language name? coz now just like two 'English' can be select.

it's name should be being taken from it's locale setting - which I assume for Simplified Chinese should be...

 

$_LANG['locale'] = "zh_CN";

certainly, if I do as suggested in your github link (rename default chinese.php and upload the github Simplified Chinese), I get two languages called 中文

 

btw - do you intend to have two different Chinese Languages available to your clients ? if you only wanted to use one Chinese, then it might be easier to use Language Overrides to change the default Chinese strings.

Link to comment
Share on other sites

I also changed

$_LANG['locale'] = "zh_CN";

 

but two languages display to choose still "中文". I guessing is it some others parameters need modify?

you could open a ticket with Support to check, but I don't think there are.

 

I believe that WHMCS assumes you're not going to have two similar languages with the same name - exactly the same thing would occur if you had two English language files using different locales (en_GB and en_US) - both would be shown as "English" in the client area.

 

I think the easiest way around it would be to use an action hook to change the name used by one of these Chinese language files in the client area...

 

to do that, create a new .php file in /includes/hooks (e.g locales.php) and paste the code below into it...

 

<?php

function locales_hook($vars) {
   $mylocal = $vars['locales'];
   foreach ($mylocal as $key => $value) {
        if ($value["language"] == "m_english") {
           $mylocal[$key]["localisedName"] = "brian";
       }
   }
   return array("locales" => $mylocal);
}
add_hook("ClientAreaPage", 1, "locales_hook");
?>

two things that you might need to change...

 

"m_english" is the filename of your Simplified Chinese language file... if you've renamed the file, you'll need to change this value too.

"brian" is the name of your language to be shown in the client area - change that to something more suitable for Simplified Chinese.

 

when you refresh the client area in the browser, you should see something similar to below...

 

2m4Pdqu.png

Link to comment
Share on other sites

  • 2 years later...
<?php

/**
* Change Language Name in the language selection list/menu.
* Here as example we used the slovak language.
* @author brian!
*/

function locales_hook($vars) {
	$mylocal = $vars['locales'];
	foreach ($mylocal as $key => $value) {
		if ($value["language"] == "slovak") {
			$mylocal[$key]["localisedName"] = "Slovenčina";
		}
	}
	$activelocale = $vars['activeLocale'];
		if ($activelocale["language"] == "slovak") {
			$activelocale["localisedName"] = "Slovenčina";
		}
   
	return array("locales" => $mylocal, "activeLocale" => $activelocale);
}
add_hook("ClientAreaPage", 1, "locales_hook");
?>

This solution/code from BRIAN is still working as well in WHMCS 7.9.1

Thanks BRIAN!!!

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