LG Multi Language v1.0.0 Add simple and easy multiple language support to your ExpressionEngine templates
Welcome!
Easily add language translation with LG Multi Language based on URL segments or subdomain. Easy to install and use making a multi-lingual version of your site has never been easier! Check out the demo to change Welcome! into German, French or Italian.
Only $49.95 $19.95 (holiday special) per license. Register to purchase!
Features
LG Multi Language provides simple and easy multiple language support for your ExpressionEngine templates. Language can be determined by a sub-domain prefix or a url segment. This extension + plugin also works with ExpressionEngines native pages module.
Demo
Below is a simple demo of language translation which translates the word hello into Italian, German and French based on the URL segments.
Hello = Hello. Hello was translated into: default
Change the language to:
The template code for this demo was as simple as:
<p>Hello = <strong>{exp:lg_ml:translate p="Hello"}</strong>.
Hello was translated into: <em>
{if lg_lang}
{lg_lang}
{if:else}
default
{/if}
</em> </p>
Requirements
LG Multi Language is an ExpressionEngine extension / plugin combination and has been tested on ExpressionEngine 1.6.0+.
Installation
The LG Multi Language addon download contains a system folder ( extension, plugin & language folders) and an example language file which is used for translations. To install the addon follow the instructions below:
- Download the latest version of the extension
- Extract the .zip file to your desktop
- Copy the
system/extensions/ext.lg_multi_lang.phpdirectory to your/system/extensions/directory - Copy the
system/plugins/pi.lg_ml.phpdirectory to your/system/plugins/directory - Copy the
system/language/english/lang.lg_multi_site.phpfile to your/system/languages/english/directory
Activation
This extension has no special activation requirements. To activate:
- Log in to your sites administration
- Open the Extensions Manager
- Enable Extensions if not already enabled
- Enable the LG Multi Language extension
- Update the extension settings.
Configuration
The LG Multi Language presently contains only one setting.
Languages [required]
it|jp
A pipe delimited list of language abbreviations. Eg: it|jp for Italian & Japanese. You can also create your own languages such as ma for Martian if you have the required language files
Usage
Determining the language
Now that the addon has been installed an setup correctly there are two options for determining which language file should be used. The extension determines which language file to use by the languages abbreviation.
Subdomains
A subdomain such as http://jp.my-site.com will let the extension know that where available use the Japanese language translation while http://my-site.com will render the site as using the default language.
Both domains should point to the same installation of the site.
URL segments
Similar to domains url segments can be used to determine which language file should be used. http://mysite.com/my-page/jp will let the extension know that where available use the Japanese language translation while http://mysite.com/my-page will render the site as using the default language.
Displaying translated content
Translated content can be displayed using either of the following methods
- Conditional Global Variables
- LG Ml plugin
Conditional Global Variables
Once LG Multi Language has determined the language from its abbreviation the value is can be accessed using the global variable. This variable can be used in standard ExpressionEngine conditional template queries. This is demonstrated below:
{if lg_lang == 'jp'}
Japanese content
{if:elseif lg_lang == 'it'}
Italian content
{if:else}
Default content
{if}
LG Ml plugin
The LG Ml plugin only has one method translate that accepts one parameter "p" which the the text you wish to have translated. An example of usage is provided below:
{exp:lg_ml:translate p="The phrase you would like translated"}
The plugin will check the required language file and replace the text if a translation is available. If no translation is available the original phrase will be rendered.
Creating a language file
Language files are used by the {exp:lg_ml:translate} plugin to translate pieces of text such as category names, menu titles or page headings.
The language file must be placed in your template_base_path/language folder in your ExpressionEngine installation and use the following naming convention: lang.your-language-abbreviation.php. A sample language file has been provided in the download.
The template_base_path is set in your ExpressionEngine administration.
Language file format
The language file follows the same format as the standard ExpressionEngine language files. The file must consist of one associative array called $L. An example is provided below:
<?php $L = array(
"original phrase" => "translated phrase",
"original phrase 2" => "translated phrase 2"
)
?>
Tag Reference
LG Ml
{exp:lg_ml} has the following methods and parameters:
Methods
{exp:lg_ml:translate}
{exp:lg_ml:translate p="The phrase you would like translated"}
Takes the "p" parameter and if the language file contains the phrase translates it. If no translation is available the original phrase will be rendered.
Parameters
p= [required in {exp:lg_ml:translate}]
p="The phrase you would like translated"
The phrase you would like translated. The phrase must have an entry in the language file to be translated.
Change Log
1.0.0
- Initial Release
License
LG Multi Language is a commercial product and therefore its usage is subject to the commercial license agreement.
Page created on: Feb 20, 2008
Last updated on: Sep 27, 2008


Enjoy LG Multi Language v1.0.0? Bookmark and share it with others.