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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By 007basaran
      Hello,
      # All PHP Requests remove extension .php .htaccess code :
       RewriteCond %{THE_REQUEST} ^GET\s.+\.php [NC]
       RewriteRule ^(.+)\.php$ /$1 [NE,R=301,L,NC]
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteCond %{DOCUMENT_ROOT}/$1.php -f
       RewriteRule ^(.*?)/?$ $1.php [L]

      # Whmcs Standart Rewrite Settings .htaccess code : 
       
      ### BEGIN - WHMCS managed rules - DO NOT EDIT BETWEEN WHMCS MARKERS ###
      <IfModule mod_rewrite.c>
      RewriteEngine on
      # RewriteBase is set to "/" so rules do not need updating if the
      # installation directory is relocated.  It is imperative that
      # there is also a RewriteCond rule later that can effectively get
      # the actual value by comparison against the request URI.

      # If there are _any_ other RewriteBase directives in this file,
      # the last entry will take precedence!
      RewriteBase /
      # Redirect directories to an address with slash
      RewriteCond %{REQUEST_FILENAME} -d
      RewriteRule ^(.+[^/])$  $1/ [R]
      # Send all remaining (routable paths) through index.php
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      # Determine and use the actual base
      RewriteCond $0#%{REQUEST_URI} ([^#]*)#(.*)\1$
      RewriteRule ^.*$ %2index-system.php [QSA,L]
      </IfModule>
      ### END - WHMCS managed rules - DO NOT EDIT BETWEEN WHMCS MARKERS ###


      Whmcs index.php |  Redirecting to = index 

      Example :     whmcs.com/index.php to whmcs.com/index

      Page not found error index php redirecting.

      How to block index.php redirection ?

      Can we disable index.php redirection without breaking the above code?

      Regards, Thanks.
    • By EZEHOST
      Hi all, 
      I am having issues with communication between WHMCS and WHM. The "Pending Module Actions" was showing an item that was waiting to be suspended, but failed "due to an unknown reason". I activated the module log, and tried suspending again, and it stated: 
      {"cpanelresult":{"apiversion":"2","error":"Access denied","data":{"reason":"Access denied","result":"0"},"type":"text"}}  
      I checked the server settings, and tried testing the connection, and I am getting the error shown in the image I have attached. 
       
      (The password is correct, and the API key is correct)
    • By WHMCS ChrisD
      In the former community we had dedicated boards for International discussions. The eagle eyed amongst you might have spotted that these no longer exist in the new community. Never fear however! We've migrated these boards over to a new section of the WHMCS Community called Clubs.  Clubs are a new way to group users with similar interests and we'll be using them for all kinds of things in future.  For now all previous international discussion posts have been moved into the appropriate club.
    • By WHMCS ChrisD
      Hi Everyone,
      The WHMCS Forums were launched over 12 years ago and in that time have seen a number of iterations and updates.
      Today, we’re excited to announce that we're getting ready to introduce the next incarnation of the WHMCS Community and with it, a brand-new look and feel, along with a whole host of new features and functionality - starting with in-line post reactions & a new reputation structure as well as a new question & answer format for certain forum categories.
      Preparations are already well underway to migrate from the current forums to our new Community powered by the Invision Community Suite. The current community is home to a wealth of knowledge and information and we’ll be migrating all existing threads and posts as well as user accounts and private messages to the new WHMCS Community to ensure that none of this is lost.
      I’m personally very excited about the opportunities our new platform unlocks. Over the coming months, we’ll be rolling out a range of new features and functionality in our community, taking inspiration from the responses we received earlier in the year about how we can improve your experience.
      Stay tuned for updates in the coming weeks as we move nearer to the switch over, in the meantime, here’s a sneak preview of what’s to come.

      The team and I are excited to bring our new community to you in September, and I will be posting more information on the changes in future posts.
    • By nasos75
      Accept payments with VISA/MasterCard using AlphaBank DeltaPay platform redirection form.
       
      * Fees calculation
      * Transaction log
      * Greek to latin first and last name conversion
      * Lifetime updates
      * 15 days trial available
      * 25 euros + 23% VAT owned version
       
      Check it here
  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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