Difference between revisions of "Language Overrides"

From WHMCS Documentation

(→‎Usage Instructions)
(Replaced content with "<div class="docs-alert-info"> <span class="title">Note</span><br /> This page has moved to https://developers.whmcs.com/languages/overrides/ </div>")
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
−
The language files are provided unencoded to allow you to view the language strings that WHMCS uses.
+
<div class="docs-alert-info">
−
 
+
<span class="title">Note</span><br />
−
However we do not recommend editing these files directly. They are often overwritten during software upgrades to introduce new and updated text.
+
This page has moved to https://developers.whmcs.com/languages/overrides/
−
 
+
</div>
−
Instead we recommend that you use overrides which allow you to customise the default variables with your own in a way which can be safely preserved through the upgrade process.
 
−
 
 
−
==Usage Instructions==
 
−
 
 
−
Steps for customising language strings via overrides are as follows:
 
−
 
 
−
1. Create the folder 'overrides' within the 'lang' folder.
 
−
 
 
−
2. Create or copy the language file you want to override.  For example, to create an override for the English language you create '''./lang/overrides/english.php'''
 
−
 
 
−
3. Open the newly created file in your preferred editor.
 
−
 
 
−
4. Start the file with a PHP tag '<?php' indicating PHP code is to be used.
 
−
 
 
−
5. Enter the variable(s) you wish to override.  For example, if you wanted to change "Welcome to our members area" you would locate the proper variable within ./lang/english.php and place it into the overrides english file with your preferred change:
 
−
 
 
−
'''./lang/english.php'''
 
−
<source lang="php">
 
−
$_LANG['headertext'] = "Welcome to our members area.";
 
−
</source>
 
−
 
 
−
'''./lang/overrides/english.php'''
 
−
<source lang="php">
 
−
$_LANG['headertext'] = "Welcome home!";
 
−
</source>
 
−
 
 
−
6. For each variable you wish you change, repeat step #5. For example, a completed overrides file should look something like this:
 
−
 
 
−
'''./lang/overrides/english.php'''
 
−
<source lang="php">
 
−
<?php
 
−
$_LANG['headertext'] = "Welcome home!";
 
−
$_LANG['addtocart'] = "Add to Basket";
 
−
$_LANG['cartproductaddons'] = "Product Extras";
 
−
</source>
 
−
 
 
−
7. Save, and you're done!
 
−
 
 
−
===Encoding===
 
−
By default the language files in WHMCS use the UTF-8 encoding without a Byte Order Marker character at the start. When creating language override files it is important to  maintain the same encoding.
 
−
 
 
−
If you have chosen to change the system charset setting to something other than UTF-8 (eg. iso-8859-1) then the language override files will need to be re-saved with ANSI encoding without a Byte Order Marketer. Most text editors have this option (including Notepad).
 

Latest revision as of 22:21, 26 February 2018