Jump to content

How to add new lang extension in language dropdown


bagfuloz

Recommended Posts

Hello everyone, Hope you guys doing good. 

I came up with something new :17_heart_eyes: or maybe old :D .  I want to implement whmcs lang from English to Hindi. for my indian customers.  So i will convert each and every English Words to hindi words.  Already 50% done.  but please anyone tell me how to Add a extension ex- Hindi in header dropdown menu and target it to my Hindi lang File. 

Check the screenshot for more info,

 

 

So i have added a Hindi.php file in Lang directory but in dropdown its showing English 2 times.

Sorry for my Bad English.  Here is all. 

Thanks

Bagful International

lang-idea.JPG

Link to comment
Share on other sites

one of the WHMCS guys, e.g @WHMCS John, @WHMCS Nate etc, may want to comment on this, but i'm not convinced the documentation on this is 100% correct (yes I was shocked too! :P)

Quote
  1. Begin by opening an existing language file, for example lang/english.php
  2. Save this file with a new name. The name you choose will be shown in the language selection dropdown menu inside WHMCS.

I don't think that's true for v6 or later that the language name is being taken from the filename - it's certainly true for v5.3.14 as i've just tested it, but failed on v6.2.2...

PpnMxVh.png

in v7.2.3, i'm seeing the same as @bagfuloz.

Quote

Each language file in WHMCS requires a locale to be defined in the following format:


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

The above defines that the language is English (en), and the region is Great Britain (GB).

The locale information is used by WHMCS to localise and display the language name localised to the native language within the WHMCS client area.

Failure to provide a valid locale will prevent the language file from showing up as available for use within WHMCS.

i'm not sure if any of that is valid in v7 - i've set the above variable to fr_FR in hindi.php and it's still showing en_GB in $locales (which is the array used for the localised name shown in the language menu) - on multiple browsers, with cleared browser and template caches... even if you totally remove the line from the file, the language file still works (contrary to what it says should happen in the docs)... it looks to me like $locales is hard-coded and not taking the locales from the language files. :?:

as also specified in the docs, both files are utf-8 encoded without BOM (though even with BOM it still works).

the only way I could think to fix this is to use a modified version of the hook I posted in the thread below...

<?php

/**
* Change Hindi Language Localised Name
* @author brian!
*/

function locales_hook($vars) {
	$mylocal = $vars['locales'];
	foreach ($mylocal as $key => $value) {
		if ($value["language"] == "hindi") {
			$mylocal[$key]["localisedName"] = "हिंदी";
		}
	}
	$activelocale = $vars['activeLocale'];
		if ($activelocale["language"] == "hindi") {
			$activelocale["localisedName"] = "हिंदी";
		}
   
	return array("locales" => $mylocal, "activeLocale" => $activelocale);
}
add_hook("ClientAreaPage", 1, "locales_hook");
?>

xT0CZq8.png

either the documentation is wrong, or this has been a bug since v6... or i'm missing something obvious as I assume users shouldn't need to use a hook to do something like this.. (though these days, any excuse WHMCS can find to require hooks to be used for the most trivial of things is seemingly enabled by default!) 9_9

Link to comment
Share on other sites

2 hours ago, brian! said:

I assume users shouldn't need to use a hook to do something like this.. (though these days, any excuse WHMCS can find to require hooks to be used for the most trivial of things is seemingly enabled by default!) 9_9

All roads do seem to be leading to that. I suppose I'd better learn how to use them better. ;)

Edited by bear
Link to comment
Share on other sites

Whooo,  That's why i said, we are missing someone on this thread, and that was brian.

Yes, that provided doc, isnt much usefull.  HOPE, WHMCS guys will update it. 

 Its working buddy,  now i can continue my WHMCS hindi language journey.

Thanks  B & B (Bear & Brian)   :16_relieved:

Link to comment
Share on other sites

Guys,  there is one more issue. 

Hindi lang is selected from dropdown menu, and its working as should be. but But selected lang name still showing - English

check screenshot for more info.

Thanks

Madan Malhotra

screen-lang02.JPG

Edited by bagfuloz
Forgot Name
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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