Difference between revisions of "Language Files"

From WHMCS Documentation

(Language Overrides)
Line 1: Line 1:
The language files in WHMCS contain all the text strings shown to clients.  This allows you to customise any of the text your clients see.
+
WHMCS supports numerous langiages, in both in the client and admin areas. To enable this, all text used throughout the system is stored within language files.
  
==Adding Support for a New Language==
+
Language files are stored in the '''/lang/''' sub-folders of both the client and admin directories.
  
If WHMCS doesn't currently have a language file for your language then you can create your own.  This is a fairly simple thing to do but will take some time to translate all the text strings.
+
__TOC__
 +
==Default Languages==
  
#Begin by duplicating an existing language file in the lang directory.
+
WHMCS includes 13 client area translations by default. These are:
#Save this with the name you want shown in the language selection dropdown menu of WHMCS - it should not contain any special characters.
 
#Once the file is duplicated, you can begin translating all the text strings in it for your language.
 
#Once complete, just save and upload the file to your live WHMCS lang directory.  You will then find the language available as an option in the language dropdown in the admin and client areas.
 
  
Be careful not to delete any of the quotation marks (") around the text strings or the semi-colons on the ends of each line (;).  Doing so will result in errors occuring when you select your language from within WHMCS.
+
'''Czech, Danish, Dutch, English, French, German, Italian, Norweigan, Brazillian & Native Portuguese, Spanish, Swedish & Turkish'''
  
==Overriding Existing Language Strings==
+
And for the admin area there are 4 translations included:
  
The language files in the /lang directory are the defaults but as of version 5 you can change any of the text displayed in the WHMCS Client Area by creating an override file containing the new strings, these will then be used to override the defaults. All text strings in the client area can be found in the language file and modified in any way you want.
+
'''Czech, English, French & Portuguese'''
  
#Begin by opening a text editor (such as Notepad) and copying in the language strings to be changed from the default language file
+
We rely on the dedication and generosity of our users for contributing translations, as we find real life translations are a much higher quality compared with using automated translation systems as some softwares do. So if you have any suggestions for improvements, or a new language file you are willing to contribute, please get in touch.
#Edit the string in the new file as necessary
 
#Save it with the same name as the default language file (eg. english.php, french.php etc.)
 
#Then upload it to the '''/lang/overrides/''' directory
 
  
For example if you wanted to change the "You are here" text to say "Current Page" then you would copy the following string from /lang/english.php and paste it into the new file:
+
==Adding a New Language==
  
  $_LANG["globalyouarehere"] = "You are here";
+
If a language you operate in is not available as standard, then you can create your own translation. Here's how:
  
Then edit so it reads:
+
#Begin by opening an existing language file
 +
#Save this file with a new name - the name you want to be shown in the language selection dropdown menu in WHMCS - the name should only consist of a-z0-9 characters and end with the extension ".php"
 +
#Once the file has been created, you can then begin going through and translating the lines within it
 +
#An example line is as follows - you should only change the part in bold:
  
  $_LANG["globalyouarehere"] = "Current Page";
+
$_LANG['accountinfo'] = "'''Account Information'''";
  
The advantage of using the overrides method instead of editing the default language files directly is that any changes made here won't be lost with each upgrade.
+
''Be careful not to delete any of the quotation marks (") around the text strings or the semi-colons on the ends of each line (;). Also should you want to use a quote character (") within your translated text, you must escape it - for example: \"  The language files are written in PHP syntax so valid PHP code must be maintained.''
 +
 
 +
==Overriding Language Strings==
 +
 
 +
Should you want to customise any of the default language file strings, we recommend using the overrides system.  Overrides as the name suggests are a way of overriding language file text values without making changes to the core language files themselves.  This has the benefit of meaning that when it comes to upgrades, you don't have any risk of overwriting and losing your customisations.
 +
 
 +
If this is your first time overriding language strings you will need to begin by creating a subfolder named '''overrides''' within the /lang/ directory (overrides are supported for both client and admin area languages).
 +
 
 +
#To start overriding language strings, begin by creating an empty file in the overrides folder matching the name of the default language file you want to override
 +
#Next copy and paste any language strings from the default file into the override file that you want to customise
 +
#Now edit the translations within the override file in exactly the same way as demonstrated above.
 +
 
 +
An example '''/lang/overrides/english.php''' file:
 +
 
 +
<?php
 +
$_LANG["globalsystemname"] = "Support System";
 +
$_LANG["headertext"] = "Welcome to our members area.";
 +
?>

Revision as of 19:49, 26 October 2011

WHMCS supports numerous langiages, in both in the client and admin areas. To enable this, all text used throughout the system is stored within language files.

Language files are stored in the /lang/ sub-folders of both the client and admin directories.

Default Languages

WHMCS includes 13 client area translations by default. These are:

Czech, Danish, Dutch, English, French, German, Italian, Norweigan, Brazillian & Native Portuguese, Spanish, Swedish & Turkish

And for the admin area there are 4 translations included:

Czech, English, French & Portuguese

We rely on the dedication and generosity of our users for contributing translations, as we find real life translations are a much higher quality compared with using automated translation systems as some softwares do. So if you have any suggestions for improvements, or a new language file you are willing to contribute, please get in touch.

Adding a New Language

If a language you operate in is not available as standard, then you can create your own translation. Here's how:

  1. Begin by opening an existing language file
  2. Save this file with a new name - the name you want to be shown in the language selection dropdown menu in WHMCS - the name should only consist of a-z0-9 characters and end with the extension ".php"
  3. Once the file has been created, you can then begin going through and translating the lines within it
  4. An example line is as follows - you should only change the part in bold:
$_LANG['accountinfo'] = "Account Information";

Be careful not to delete any of the quotation marks (") around the text strings or the semi-colons on the ends of each line (;). Also should you want to use a quote character (") within your translated text, you must escape it - for example: \" The language files are written in PHP syntax so valid PHP code must be maintained.

Overriding Language Strings

Should you want to customise any of the default language file strings, we recommend using the overrides system. Overrides as the name suggests are a way of overriding language file text values without making changes to the core language files themselves. This has the benefit of meaning that when it comes to upgrades, you don't have any risk of overwriting and losing your customisations.

If this is your first time overriding language strings you will need to begin by creating a subfolder named overrides within the /lang/ directory (overrides are supported for both client and admin area languages).

  1. To start overriding language strings, begin by creating an empty file in the overrides folder matching the name of the default language file you want to override
  2. Next copy and paste any language strings from the default file into the override file that you want to customise
  3. Now edit the translations within the override file in exactly the same way as demonstrated above.

An example /lang/overrides/english.php file:

<?php
$_LANG["globalsystemname"] = "Support System";
$_LANG["headertext"] = "Welcome to our members area.";
?>