Docs: Language Variables
Show AllHide All
Body Tag Classes
Last update: Snippets
by Sean on Friday 13th of October
Vendo displays pre-defined text using lang variables (PHP constants). These can be overwritten using the files in your /lang/ directory. These are the files that load when editing Language through the website admin in /admin/language/ but you can also edit these files via FTP.
By default, Vendo copies the basic directory structure into your lang directory but does not include any files. This is so we don't add any files unnecessarily - Vendo checks to see if the file exists before attempting to load it - if it doesn't exist the Vendo default lang file is used.
If you want to use the lang files to change the text that is displayed, you'll need to add the appropriate files - it is easier to do this through the website admin but you can also just create the files via FTP.
The global lang file
The simplest way to overwrite a lang variable is to use your global lang file. This file must be called global.inc.en and be located in:
Example lang var
Here is an example of changing the default word for "Shop" to "Store":
If this lang variable is in the global lang file it will overwrite all occurences of the __shop variable, on all pages. If you only wanted to change the word on one page, say the contact page, you'd create a file in /contact/ called index.php.en and add the above code. If you are not sure what the correct name of the file should be use your website admin to change the variable and Vendo will create the file for you.
While there is file list of all lang variables, other than in the website admin, you can guess the correct name of the variable to use by observing that lang variables are:
- all lower case
- use underscores in place of spaces
- use no more than five words.
E.g. the lang variable for "Please complete all the required fields." would be:
define('__please_complete_all_the_required', 'Please complete all the required fields.');
Individual page files
Every page loads a unique Vendo lang file, then loads your custom lang file, if it exists.
Note that if an individual page and the global file both contain the same variable, the global lang file variable will apply. Your global lang file will overwrite the Vendo lang file.
Adding a new language
To add a new language a new var will need to be added to the lang table in MySQL, which will then display as an option in Preferences. Contact Vendo to request this and we'll also copy the current set of en lang files to the new lang directory. The master lang files are in /lang/en/