BuycPanel Blog

BuycPanel Blog

Latest news and updates

Determining Browser Locale in cPanel

Posted by Allura on 02 09 2019.

 In cPanel and WHM version 11, there is a new feature that allows the user to determine the locale. There are certain factors in parameters that goes into determining the locale in cPanel. The localised login page stores the browser locale in a cPanel account. There are certain factors like the locale query string parameter, the session_locale cookie, the Accept-Language header, etc.  that help in determining the visible locale when one logs into their cPanel, Webmail or WHM account.Main factors in determining browser locale in cPanel
The cPanel Service Daemon, better known as cpsrvd service run the following steps when the user logs into their cPanel, Webmail or WHM account for determining which locale to display. The steps are mentioned below.Locales are generally used in the URL of a website. URL stands for Uniform Resource Locator. As the name itself suggests, a URL based on Russia will have “.ru” as…

 

In cPanel and WHM version 11, there is a new feature that allows the user to determine the locale. There are certain factors in parameters that goes into determining the locale in cPanel. The localised login page stores the browser locale in a cPanel account. There are certain factors like the locale query string parameter, the session_locale cookie, the Accept-Language header, etc.  that help in determining the visible locale when one logs into their cPanel, Webmail or WHM account.

Main factors in determining browser locale in cPanel

The cPanel Service Daemon, better known as cpsrvd service run the following steps when the user logs into their cPanel, Webmail or WHM account for determining which locale to display. The steps are mentioned below.

  • Locales are generally used in the URL of a website. URL stands for Uniform Resource Locator. As the name itself suggests, a URL based on Russia will have “.ru” as the login locale for that website. The browser will set the session_locale cookie to the same value based on the locale query string parameter if it is present in the URL.

 

However, the validity for the locale session is for one year and can be overridden by the session_locale cookie.

  • Given, there is already the session_locale cookie in the user’s browser, the specified locale is set for the login interface and also for the rest of the user’s session by default.
  • In case of no locale query string specification in the URL and a negative for session_locale cookie in the browser, the cpsrvd service will review if the user’s browser has sent an Accept-Language header.
  • For a situation where none of the above-mentioned parameters has been configured by the user, the selected locale in the Server Locale option of the WHM’s Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings) will be used by the login system. The cPanel and WHM account holders should note that the setting is stored as the service_locale variable in the /var/cPanel/cpanel.config file by the cPanel and WHM stores.

 

One thing to note for the users is that the cpsrvd service will only use the first service locale that is allocated Accept-Language header. The proper way is to look at the HTTP Accept-Language header sent to the server. This contains the ordered, weighted list of languages the user has configured their browser to prefer. For a browser and system set-up that does not align with any of the above-mentioned conditions, the login system will opt for the default locale which is the U.S. English locale.