bagfuloz Posted October 13, 2017 Share Posted October 13, 2017 Hello everyone, Hope you guys doing good. I came up with something new or maybe old . 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 Link to comment Share on other sites More sharing options...
bear Posted October 13, 2017 Share Posted October 13, 2017 Did you follow these instructions? https://developers.whmcs.com/languages/adding-a-language/ Link to comment Share on other sites More sharing options...
bagfuloz Posted October 13, 2017 Author Share Posted October 13, 2017 Yes i did same. i have created one file name Hindi.php Right now this file included english.php file data, but in dropdown, there is showing two English lang selections. Thanks Link to comment Share on other sites More sharing options...
brian! Posted October 13, 2017 Share Posted October 13, 2017 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! ) Quote Begin by opening an existing language file, for example lang/english.php 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... 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"); ?> 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!) 2 Link to comment Share on other sites More sharing options...
bear Posted October 13, 2017 Share Posted October 13, 2017 (edited) 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!) All roads do seem to be leading to that. I suppose I'd better learn how to use them better. Edited October 13, 2017 by bear Link to comment Share on other sites More sharing options...
brian! Posted October 13, 2017 Share Posted October 13, 2017 2 hours ago, bagfuloz said: i have created one file name Hindi.php it will have to be called hindi.php (lowercase - the docs seem to be correct on that part at least!) Link to comment Share on other sites More sharing options...
bagfuloz Posted October 14, 2017 Author Share Posted October 14, 2017 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) Link to comment Share on other sites More sharing options...
bagfuloz Posted October 14, 2017 Author Share Posted October 14, 2017 (edited) 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 Edited October 14, 2017 by bagfuloz Forgot Name Link to comment Share on other sites More sharing options...
brian! Posted October 14, 2017 Share Posted October 14, 2017 5 hours ago, bagfuloz said: Guys, there is one more issue. take a look at the hook, I updated it yesterday when the same thing occurred to me... if you try the above hook again, it should work fine. Link to comment Share on other sites More sharing options...
bagfuloz Posted October 16, 2017 Author Share Posted October 16, 2017 Its done, Working. Thanks brian. Link to comment Share on other sites More sharing options...
Recommended Posts