Path

ez.no / exponential / documentation / configuration / configuration / language and charset / how to setup a multilingual...


How to setup a Multilingual Site

Exponential 3.1+ has made multilingual site implementation rather easy, though it is not straight forward or well documented. This document is an attempt to begin to systematize the knowledge and experience surrounding multilingual websites and offer a space whereby others can contribute to the community documentation. I am a relatively new ezp user and will try to make this as user-friendly as possible. This document respresents a compilation of notes, documentation, forum messages and experiences.

I have broken down the aspects of multilingual websites into the following categories:

  • methods for achieving a multilingual website
  • administation of a MLW
  • configuring and setup for a multilingal websites (MLW)

Methods for achieving a multilingual website

Exponential 3 makes managing a MLW easy from the admin area. The tricky part seems to be in getting it set up correctly and then being able to display the content as desired. Based on what others have tried, there seem to be two general approaches to the former in exponential3. The first is the method that was built into ezp3 and primarily involves configuring exponential (through the siteacess and site.ini settings) to display the appropriate language based on the url address. The other method involves the use of information gathered from the user naviagating the site and depends on the use of modules not currently included with exponential. As I do not know of any public modules and want this to be as accessible as possible, I will focus on the former (siteacess) method.

Administation of a MLW

Once the MLW is setup, administering a multilingual site (done through the admin area) involves two main tasks:

  • establishing the languages for translations/languages for your site
    While you are logged in to the admin area, go to Setup and click on the Translations button in the left column. Here you can add new languages and locale settings for your site (this may be unnecessary if you installed the multilanguage site as described below). To do so, you need to select a translation (or the 'custom' option), enter its name (ex. 'Spanish'), and locale information (this is done using a code composed of a three letter identifier for the language and a two letter, uppercase, identifier for the country, such as eng-US (English, USA), esl-ES (Spanish, Spain) - see links below. Press 'Create' and you are done. Now a translation for that language can be added to any of your site's content.
    Countries are specified by the ISO 3166 Country Code
    Language is specified by the ISO 639 Language Code
  • managing and creating translations for your content
    Now while editing your content, you can click on 'Manage' in the Translations box of the menu on the right hand side. There you can add a translation for the content object and translate it (with the original text beside what you are translating). Don't forget to publish it!

Translations are not versioned independently. If you want need that feature, it is recommended that you use different objects for different languages. You can then link the objects to their counterpart in other languages using the related objects function (also in right-hand menu). Also, this solution has advantages if your multilingual site has certain workflow demands. For example, having separate content objects for each language is also the best solution if you want translations made while the main language is published. In this case, the site manager would tell the translators to copy the original object and create the translations.

Please note that in version RC2 of exponential3, there was a bug where you would get no translations if the current language was placed before the others in the translation list.

Configuring a Multilingual website

Multilingual installation of exponential

When you first install exponential, the setup and installation tool lets you chose to make your site multilingual (and also which language should be the principle language for your site). If your translation does not ship with the exponential distribution, install it before installing exponential (see below).

Installing a translation

There are many translations for the exponential administration area available. Please see links below to find your translation and for instructions on how to easily install a translation. If you install the translation before installing exponential, the setup wizard will automatically configure the admin area to your preferred language and configure the site to allow all your other chosen translations for text. It is advisable, though not necessary, to setup the multilingual site at the installation because it is easier and helps avoid database errors that can be caused by changing language configurations.
If you install translations after your initial setup, you can still set up the site as multilingual. After you download and uncompress the translation files, you should set configurations according to your preferences (principal language, admin area language, etc). By setting your Locale variable, you can deploy the prefered language for the site admin area. By setting the ContentObjectLocale, you set the language for the content you develop. If you are unsure, do not change the later.

Where to get translations
How to install a translation or here.

Siteaccess method setup

The site access settings let exponential receive configuration information based on the url address that is passed to it. So that exponential knows which language to present, we must configure the site access settings to present content in a certain language based on the url. The way this is done for multilingual sites is the same as for hosting several sites on one exponential installation (the difference being you do not necessarily have different content architecture in MLW). There are several ways this can be done in site access (see all of them at here).

I describe the process in three steps:

  • 1. Tell exponential how to figure out which language to display (by the url used)
  • 2. Create and edit siteaccess files and folders.
  • 3. Fine tune

Step by step:

Step 1.

A typical, simple configuration (though not the only) for a multilingual site is to have each language have a distinct directory after the main address to access a certain language (ie, site.com/index.php/en, site.com/index.php/es, etc). To configure this setup, we start by editing settings/override/site.ini.append with (some of this may have been done for you during the installation, adjust as necessary):

[SiteAccessSettings]

#this part tells how the site access setting is chosen, in this case, by the uri

MatchOrder=uri

URIMatchType=element

URIMatchElement=1

URIMatchRegexp=^/([^/]+)/

URIMatchRegexpItem=1

#this part tells ezp which siteaccess folders are available

AvailableSiteAccessList[]=en

AvailableSiteAccessList[]=es

AvailableSiteAccessList[]=br

AvailableSiteAccessList[]=admin

DebugAccess=enabled

 

[RegionalSettings]

#allow translations

TextTranslation=enabled

#cache the translations, can be disabled if desired (can take a long time the first time the language is accessed)

TranslationCache=enabled

 

[ContentSettings]

#translations available for the content

TranslationList=eng-US;esl-ES;por-BR

#you can enable this after you have everything setup, leave it disabled to see if you did it right!

ViewCaching=disabled

That is it! Some alternative setups are possible too (each of these change slightly the SiteAccessSettings configuration shown above). Again, see the site access documentation to figure out how:
- Virtual host (www.site.es, www.site.br or www.en.site.com, www.es.site.com, etc)
- Index (index_en.php, index.es.php)

Step 2.

Create one siteaccess folder for every language. The configuration files in these folders give exponential the correct language settings when the site is accessed. The folder names must be the same as the url directory name setup in step 1. In this example (site with English, Spanish and Portuguese), the resulting folders look like this:

settings/siteaccess/en  (English)

settings/siteaccess/es  (Spanish)

settings/siteaccess/br  (Portuguese)

(note*this may be in addition to your admin folder and configuration, which can also be configured with language information)

In each folder create a site.ini.append.php file. In the site.ini.append.php you can specify any number of values to differ from the main/default setup, such as different design folders, languages, login preferences. Take a look at settings/siteaccess/demo/site.ini.append and settings/siteaccess/admin/site.ini.append for examples. Whatever your other configuration decisions, the crucial part for multilingual is to set the Locale and ContentObjectLocale you want to use for that specific area of your site. For example, in my example case, the primary language is Spanish (for admin and user area, which are set in the settings/override/site.ini.append file). For the English part of my site, I edit settings/siteaccess/en/site.ini.php to have:

[RegionalSettings]

Locale=eng-US

HTTPLocale=en

ContentObjectLocale=eng-US

Next do the same for each respective siteaccess/whateverlanguage/site.ini.php file.

Text translation is automatically disabled when the Locale is set to eng-GB in settings/site.ini. Since we will need text translation, we have to change these variable settings in the settings/site.ini (otherwise the above work will not take effect). In settings/override/site.ini.append(.php) you can't override Locale, HTTPLocale and ContentObjectLocale; these are set in the siteaccess ini files. So first, in the settings/site.ini file, we comment out the following parts (with the '#' mark):

[RegionalSettings]

#Locale=eng-GB

#HTTPLocale=

#ContentObjectLocale=eng-GB

Step 3.

Fine tuning
If you are setting up several sites with one Exponential 3 installation using site access, you might want to separate the cache and storage directory. This will make things less cluttered and easy to manage when having many sites per installation. The default settings in Exponential 3 stores cache and files in a common directory for all sites. This can cause problems if you e.g. want to move one of the sites to another server in the future. This can be changed by setting some variables in your site.ini.append for each of your sites.

It is important that both the user and the admin site has the same storage directory. Otherwise if you e.g. upload a new file using the admin site, the user site will not be able to locate the file because it is looking for it in the wrong directory. Also, make sure that Apache has sufficient rights for the folders you create.

For example - separate storage files and cache for 'site.com/es', 'site.com/en', 'site.com/br' and 'site.com/admin'.
Please seen the original of this

Non latin languages and unicode:
If you need a language that does not use the latin character set, you will have to change this in settings/i18n.ini which defines the core charset for the site. With UTF-8 (Unicode) you can get most languages in the world on the same site at the same time.

See Unicode with Exponential

Comments

It doesn't work!!!

I also followed this article but my ez doesn't work very well. I use two languages ("cat" [cat-ES, catalan version] and "es" [esl-ES, spanish version]), but it works like two different sites. I can log in (for example in the catalan), but when I change the language then i can't acces and i must log again! It works like two different websites with two different sessions!!!! How i can resolve this? I want to change between languages maintaining the same opened sesion!

Sorry about my poooor english! Thanks!!!

Language Selector

How do you add a language selector?

but how to keep the language stored

Hi,

I used the code supplied in the comments to create a language selector. Works like a charm.

However, after changing the language and clicking away, the language of the site defaults again to the default language.

How to store the language selected by a user?

Thanks,

Babak Fakhamzadeh

That tip how not to use siteaccess is excellent

Thank you very much! You saved me a ton of trouble.

Displaying languages when siteaccess is not used




{* Code to show list of translations *}


{* to use pictures, instead of text uses st.like this: 'esl-ES',concat('<img src=',"picture_name.png"|ezimage,'/>') *}


 

{let languages=hash('cat-ES','Catalan', 'chi-CN','Chinese', 'cze-CZ','Czech', 'dan-DK','Danish', 'dut-NL','Dutch', 'eng-CA','English (Canada)', 'eng-GB','English (United Kingdom)', 'eng-US','English', 'esl-ES','Espa�ol', 'esl-MX','Castillan', 'fin-FI','Finnish', 'fre-CA','French (Canada)', 'fre-FR','Fran�ais', 'ger-DE','German (Germany)', 'hun-HU','Hungarian', 'ita-IT','Italian', 'nno-NO','Norwegian (Nynorsk)', 'nor-NO','Norwegian (Bokmal)', 'pol-PL','Polish', 'por-BR','Portuguese (Brasil)', 'por-MZ','Portuguese (Mozambique)', 'por-PT','Portuguese (Portugal)', 'rus-RU','Russian', 'swe-SE','Swedish')


 

all_translations=$node.object.current.translation_list}


   {section show=$all_translations|count|gt(0)}


           {section var=translation loop=$node.object.current.translation_list}


               <a href={concat($node.url_alias,'/(language)/',$translation.item.language_code)|ezurl}>{$languages[$translation.item.language_code]}</a> | 

           {/section}


   {/section}


{/let}


yes something fishy

I had same problem followed article and got same problem cannot connect to DB.
Also read other articles in forum in each had something different not mention in the other, I followed all and as a result website start to show setup page fine tune etc.
So where i can find "Correct" manual how to add 2nd language, i have 1 language Ez Publisher works fine and wand to add 2nd.
Everywhere is writen how from 2 languages to add 3rd may be there is the fishy part i dont know.
Would be nice if someone solve this issue.

what's wrong?

hi all
i followed this article but i was not able to make my site work
i already have a site "overriding" the existing corporate site on my own computer (I access it through localhost/index.php/corporate).
now i need to make it multilingual.
so i have only a design folder (corporate) and 3 siteaccess folders (corporate, en [english version], it [italian version]).
i copied the siteaccess site.ini.append file from the corporate directory to the en and it directories and i changed only the regional settings ([databasesettings], [sitesettings] and so on are the same).
it doesn't work properly when i try to access the italian (or english) site by the url: "localhost/index.php/it" ("localhost/index.php/en"). i get the kernel 50 error ("No database connection could be made, the system might not behave properly.") and the login form. the only thing working properly is the login form language (italian accessing /it, english accessing /en). any hint? thanx a lot

Log in or create a user account to comment.

Contents

Configuration

Configuration
    WebDAV setup
    Exponential running on a CGI version o...
    Path prefix
    Locale Settings
    Introduction
    Configuration files
    Site access
    Common settings
    Multi Site
    Directory structure
    Language and charset
       Installing a Language pack
       Multilanguage site
       Unicode with Exponential
       Creating a new translation
       How to setup a Multilingual Site
    Cron jobs
    Login handler
    Search engine
    Tips & Tricks
Security
Optimization
Backup & Restore
Troubleshooting


Created

18/09/2003
3:04:17 pm
by New User

Last updated

18/09/2003
4:38:41 pm
by New User

Authors

New User



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.