Multi Language Support (MLS)

license
Commercial
version
2.2.0
author
Can Oğuz
Last Updated
22.08.2012
Buy Now

MLS is built to aid designers to create multi-lingual web sites using ExpressionEngine.

Features

  • Ability to hide extension setting panels from selected member groups.
  • Ability to automatically output the correct translation of channel custom fields.
  • Let's you define and manage as many languages as you want.
  • Automatically creates routing folder and files for languages.
  • Automatically decides what language to show to visitors.
  • Adds five global variables that can be used in templates: language, language_code, default_language, default_language_code, site_url_wlc.

WARNING

  • For MLS extension to work properly, the file permissons for your ExpressionEngine's root folder (i.e public_html or www) must be set to 755 or 777.
  • This plugin enables you to change language by attaching the language code after your domain (i.e. http://www.yoursite.com/en/). If you want to change this to a subdomain syntax you need to add an .htaccess file to all freshly created language folders. Also for SEO friendly URLs; you need to maintain sepearate .htacess files at all freshly created language folders. 
  • Template caching will cause MLS to not work properly.

Index

Installation

  1. Download and unpack the package.
  2. Upload the folders bbr_gettext, bbr_langswitcher, bbr_languagelist, and bbr_multilanguagesupport into your system/expressionengine/third_party folder.
  3. Upload the bbr_multilanguagesupport folder located within the themes folder of your downloaded package into EE's themes/third_party folder.
  4. Go to Add-ons / Extensions and enable MLS.
  5. Setup your extension.

Setting Up MLS

Extension Settings

Settings Panel:

  • Settings Visibility:
    You can hide the settings panel from some member groups. All you have to do is to select the groups from which you want to hide the settings panel. Note that the default "Super Admins" group is not visible on this list. The settings panel is the first part of the MLS settings screen where you define different behaviors of MLS and this setting hides that part of screen.
     
  • Translation Visibility:
    You can hide the translations panel from some member groups. All you have to do is to select the groups from which you want to hide the translations panel. Note that the default "Super Admins" group is not visible on this list. The translations panel is the second part of the MLS settings screen where you define site-wide translations and this setting hides that part of screen.
     
  • Default Language Mode:
    This setting defines the mechanism that sets the language of new visits that access the site withoud any language code provided in URL.

    Default Language Mode

    There are three options defined here:

    From Browser:
    This option forces MLS to set site language to visitor's browser language. If the browser language is not defined in MLS then the default language is shown.

    From Cookies:
    This option forces MLS to set site language based on user cookies. If no language related cookie is stored, MLS checks first the browser language and then the default language and shows the site in first available language.

    From System:
    This option forces MLS to set site language based on the system default language.
     
  • Default Language:
    Default Language

    This setting defines the default language of your web site. The drop down includes MLS defined languages.
     
  • Available Languages:
    Available Languages

    To add a new language you simply need to click on + Add Language link. 

    CAUTION



    Language field must contain only alphabetical characters and only characters from English Alphabet. Think this field as the url_titie field. No special characters with umlauts etc. are allowed.

    Language Alias can have any value of your choice such as Française.

    Language Code field must be a two-to-four letter ISO language code. If you use a non-standard language code, the auto detection will not work properly. For example you need to "en" for English and "tr" for Turkish.

    To remove a language you simply need to click the icon towards right of the language you want to delete.

  • Storage Engine:
    This option defines where you will save your translations. The defaul value is Database.

    Database:
    Stores all translations in database.

    File:
    Stores all translations into a text file.

 

 

Translations Panel:

Here you can define as many translations as you want.  The key column is required as this will be used in templates to output the translation.

Static Text and Translations

Defined text is accessible via template variables using {bbr-mls-key} where key is your defined key for given text.

CAUTION

key field must contain only alphanumeric characters from English alphabet. No special characters with umlauts etc. are allowed. You can use dash and underscore. The character case is not important.

WARNING

Disabling the extension will cause you to lose all your translations.

Global Variables

  • {default_language}
    Outputs the default language as set in MLS setting panel.
  • {default_language_alias}
    Outputs the alias of the default language.
  • {default_language_code}
    Outputs the language code of the default language.
  • {language}
    Outputs the current language.
  • {language_alias}
    Outputs the alias of the current language.
  • {language_code]
    Outputs the code of the current language.
  • {site_url_wlc}
    Outputs your site URL with the language code appended to it.
    i.e. http://www.yourdomain.com/tr/

Usage

To use this extension you have several setup options.

The two most commonly used options are Channel Based Setup and Custom Field Based Setup. Each of these methods have their own advantages and disadvantages. You have to think about them and decide your setup by yourself based on your own criterion.

--

Example Scenario:

You have a site with English (en), Turkish (tr), and German (de) as your languages and you need the means to store details of your products. Your default language is English (en).

-- 

Channel Based Setup

This setup requires you to duplicate your channels for each language. Create a channel with the short name product_en to store your product details in your default language. Then dupllicate this channel two more times with these names product_tr and product_de.

Now in your templates you can do this:

{exp:channel:entries channel="product_{language_code}"}
	    {product_name}
{/exp:channel:entries}

Custom Field Based Setup:

This setup requires you to duplicate your fields. Assuming that you have a channel named product, create a field with short name product_name_en for your default language. Then create two identical copies of this field with the short names product_name_tr, and product_name_de.

When you add a new entry fill all product name translations in corresponding fields.

Now in your templates you can do this:

 

{exp:channel:entries channel="product"}
	    {product_name_{language_code}}
{/exp:channel:entries}

or better

 

{exp:channel:entries channel="product"}
	    {bbr-mls:product_name}
{/exp:channel:entries}

These usage examples can be extended with Matrix field and {if} conditionals. You can find more information in FAQ section.

WARNING:

MLS functionality in part or in full may not work as expected if used  with third-party field types. Please contact our support for pre-sale compatibility questions.