Creating multilingual siteaccesses

As we saw, eZ Publish created a siteaccess for every language that we enabled in the first chapter. If we'd like to add more languages for our site, we need to create a new siteaccess folder and configure the language settings inside it.

Let's create, for example, a German siteaccess. This task can be summarized in the following three steps:

  1. Create a new folder called de, inside settings/siteaccess/.
  2. Copy the files or create the appropriate symbolic links as per the eng siteaccess, inside the de folder.
  3. Configure the siteaccess .ini configuration files for the language.

Copying the configuration file

We need to create all of the .ini files from the main language siteaccess in the new language folder (de). To do this, we need to create a symbolic link for all the files, except the site.ini.append.php, that are to be copied into the new folder.

Editing ini files for locale components

Configure all of the site.ini.append.php files for all of the languages siteaccesses, to enable the new German language.

To do this we will edit the files, adding the highlighted code:

# vi settings/siteaccess/eng/site.ini.append.php
[RegionalSettings]
Locale=eng-GB
ContentObjectLocale=eng-GB
ShowUntranslatedObjects=enabled
SiteLanguageList[]=eng-GB
SiteLanguageList[]=ita-IT
SiteLanguageList[]=fre-FR
SiteLanguageList[]=de-DE
TextTranslation=disabled

Do the same for the site.ini.append.php files in the fre folder and the ita folder.

After that, we need to copy the eng/site.ini.append.php to our new folder, de, and edit it as follows:

[RegionalSettings]
Locale=de-DE
ContentObjectLocale=de-DE
ShowUntranslatedObjects=enabled
SiteLanguageList[]=de-DE
SiteLanguageList[]=eng-GB
SiteLanguageList[]=ita-IT
SiteLanguageList[]=fre-FR
TextTranslation=enabled

The directive SiteLanguageList tells us the order in which the system will show the content for our objects. If the content isn't translated into German, eZ will show the English version; if the English version is unavailable than it will show the Italian one, and so on.

The last step is to add the new languages inside the settings/override/site.ini.append.php, as we did for the dev and staging siteaccesses:

[SiteSettings]
..
SiteList[]=fre
SiteList[]=ita
SiteList[]=eng
SiteList[]=de
[SiteAccessSettings]
..
AvailableSiteAccessList[]=fre
AvailableSiteAccessList[]=eng
AvailableSiteAccessList[]=ita
AvailableSiteAccessList[]=de
..
RelatedSiteAccessList[]=fre
RelatedSiteAccessList[]=eng
RelatedSiteAccessList[]=ita
RelatedSiteAccessList[]=de
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.138.14