Jump to content
bagfuloz

How to add new lang extension in language dropdown

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
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!)

Share this post


Link to post
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:

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
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. :idea:

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Similar Content

    • By So, who am I ?
      Hello
       
      I use OrderDomainPricingOverride hook to change some domain price manually, I need two registrars to use this hook, but when I add hook file to the second registrar's folder I get blank page and the whole site shuts down.
       
      I don't use any registrar function in the file, I just check domain's sld and tld and generate price, how can I manage to use the hook for both registrars ?
      this is my whole hook file:
      <?php /** * WHMCS SDK Sample Registrar Module Hooks File * * Hooks allow you to tie into events that occur within the WHMCS application. * * This allows you to execute your own code in addition to, or sometimes even * instead of that which WHMCS executes by default. * * WHMCS recommends as good practice that all named hook functions are prefixed * with the keyword "hook", followed by your module name, followed by the action * of the hook function. This helps prevent naming conflicts with other addons * and modules. * * For every hook function you create, you must also register it with WHMCS. * There are two ways of registering hooks, both are demonstrated below. * * @see https://developers.whmcs.com/hooks/ * * @copyright Copyright (c) WHMCS Limited 2016 * @license https://www.whmcs.com/license/ WHMCS Eula */ // Require any libraries needed for the module to function. // require_once __DIR__ . '/path/to/library/loader.php'; // // Also, perform any initialization required by the service's library. /** * Register a hook with WHMCS. * * add_hook(string $hookPointName, int $priority, string|array|Closure $function) */ add_hook('AdminHomeWidgets', 1, function() { return new SampleRegistrarModuleWidget(); }); add_hook('OrderDomainPricingOverride', 1, function($vars) { // Perform operations to determine price // logActivity('OrderDomainPricingOverride 900', 0); $domain = explode('.', $vars['domain']); $sld = $domain[0]; $tld = '.' . $domain[1]; $domain_name = explode('.', $vars['domain']); if(count($domain_name)==2 && strlen($domain_name[0])==2 && $domain_name[1]=='ge'){ return 900.00; } }); /** * Sample Registrar Module Admin Dashboard Widget. * * @see https://developers.whmcs.com/addon-modules/admin-dashboard-widgets/ */ class SampleRegistrarModuleWidget extends \WHMCS\Module\AbstractWidget { protected $title = 'Sample Registrar Module'; protected $description = ''; protected $weight = 150; protected $columns = 1; protected $cache = false; protected $cacheExpiry = 120; protected $requiredPermission = ''; public function getData() { return array(); } public function generateOutput($data) { return <<<EOF <div class="widget-content-padded"> Your widget output goes here... </div> EOF; } }  
       
    • By ModulesGarden
      1. You wouldn't trust a random person you have just met on the street with your money, would you? Then why risk outsourcing development of your treasured custom project to some company you have little or no knowledge about? Despite how much you would love to hear that, there is no universal formula for choosing the perfect software provider simply because your situation is just as unique as your business needs. However, going through the process of finding a suitable candidate will be a lot easier if you follow our brief guide. Get familiar with these 6 must-ask questions and learn how to get your hands on a massive $100 boost from ModulesGarden!
      Find the guardian of your dream custom project!
       
      2. What key components would a comprehensive panel for data center management need to have for you to call it trail-blazing and absolutely indispensable for any go-ahead enterprise? Accelerating all sorts of repetitive tasks to the maximum? An admin-friendly interface, transparent design and all urgent tools always at your fingertips? How about automating the installation & configuration of multiple operating systems on your servers without spending a minute more than necessary? Because all of that can already be said without a hesitation about the newest EasyDCIM v1.5.0 and their revolutionary, novel Core Provisioning Module!
      Step on the road of a full-blown automation!
       
      3. ModulesGarden team gets fueled up by both endorsing innovative software as well as creating it. Our latest move in this direction - the 3.0 edition of the invincible Plesk Extended For WHMCS module is now up for download.
      We could go on and on about all newly supplied functionalities of this bracing release, but we can easily narrow it down to the 3 focal points: added support for the Softaculous auto installer, time-saving capability to perform mass actions on various components in client area, and a modernly-shaped framework smoothing the overall working of the module.
      Sounds convincing enough to devote to this utilitarian tool for complex handling of web hosting accounts a bit of your attention?
      Learn All About Plesk Extended For WHMCS 3.0!
       
      4. Sharing your opinion with ModulesGarden never hurts, but can bring you quite a lot of benefits in return. How's that? Stop by our Blog and see the results of our most spine-tingling prize draw ever! Who scooped up Emoji Picker For WHMCS module free of any costs for a whole year? Congrat the winners!

       
      Need Custom Software Development For Your Business?

      Get Your Free Quote Now!


      Specially for you we will adapt an application and its design to your own needs, create a new module or even a completely new system built from scratch!
       
    • By ModulesGarden
      Every person or organization deciding to hire a custom software development company is different.
      And yet, they are all looking for the same exact thing  - a partner who will develop a product being an ideal realization of their idea.
      So, how do you find that one specific software provider amidst thousands of experts out there in the market?

      It is indeed a very fickle job and must done with prudence. To let you walk this tightrope more confidently,
      we have compiled a list of 6 questions to ask a software development company before reaching the partnership decision.
       
      Consider going for ModulesGarden services? By all means, put these guidelines into practice and a welcome $100 credits gift will be applied to your account!
      https://www.blog.modulesgarden.com/choosing-the-right-software-house
    • By bellafronte
      Hello WHMCS Community!
      I'm having a little challenge on a custom theme. I need to override some translations in a specific theme through the language file.
      This need is to be able to meet the need of the theme in changing words in the translation that help the user in the products that will be displayed in this theme, but this could not change the standard translation used in other WHMCS themes.
      Is it possible to create a translation file that is used only on a specific theme?
    • By So, who am I ?
      Hello
      I'd like to sell domains with different price and currency for customers who visit from outside my country.
      I'm thinking to use OrderDomainPricingOverride hook to change price for non local customers, I plan to differ local and non local customers by their IP. But before I start, thought to ask here, maybe there's a better built in way of doing it that I couldn't find.
      I see I can add another currency to WHMCS but it says:  Customers who visit your site can then choose to shop in their local currency.
      I don't want customers to have to choose currency, I want local ones to shop with local currency and non local one with non local currency. I still can differ it manually by IPs I know, just want to know if WHMCS has some extra features for it that I can use.
  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines