Multi-language site management

In Chapter 1, during the installation, we enabled the support for multi-language in eZ Publish. Then in Chapter 2, we created site accesses for those languages, by adding failover capabilities to the CMF if content is not translated in the main language. The next step is to manage the language from the eZ Webin backend.

Log in to the backend from http://packtmediaproject/index.php/dev_panel/ and then, in the Setup tab, click on the Languages link in the leftmost menu.

Multi-language site management

Here, we can see all of the enabled languages and the related translated objects. If we click on a language, eZ Publish will show all the locale info settings for that language.

From this page, we can also add to or remove new languages from the CMF easily, as we did from the shell.

Note

We can remove a language only if it does not contain any content objects.

Class attribute translations

As noted earlier, eZ Publish allows translating any single object or attribute. This is very useful for displaying the attribute labels in the correct language in the backend or the frontend of the CMF.

To translate a class object, we need to go in the Setup tab and then click on the Classes links located in the leftmost menu.

Class attribute translations

Here, we can see a list of all of the content classes that have been created in the CMF. To translate them, we have to select them one by one, and then add the translation. As an example, we will translate the Article class.

After we click on the name of the class, we will be redirected to the class summary page.

Class attribute translations

Here we can see all of the information related to the class and, moreover, we can edit it by adding new attributes or managing the languages. From the drop-down box, select the Another language link, and then click on the Edit button.

Class attribute translations

The system will ask us which language we want to enable for the class. We can select one of the installed languages, and also on which translated language we want to base the new translation. This should be very useful for languages such as eng-GB or eng-US, where only small cosmetic changes need to be made.

After we select the new language, we need to click on the Edit button, and can then start translating all of the contents of the page.

Class attribute translations

The edit form that opens is the same as the one that we saw in Chapter 3 when we created the content object for the articles. In this case, we don't need to add anything new except for the translated strings. For example, we start by translating the Article object into Italian, giving its Italian name Articolo, and the translation for the title value (Titolo).

Tip

Apart from the strings, we can also change the default behavior of the content attributes, adding—for example—a default value for the publication date (instead of an empty value), or removing a searchable flag.

After we have translated everything, and saved our work by clicking the OK button, we will be redirected to the class summary page for the newly inserted language.

Class default language

If our editors are from Italy, we can choose to use Italian as the default language for the entire content class.

To do this, in the Classes link of the Setup tab, locate the class that you wish to edit and click on the name of the class. Then, enable the translations window, select the desired language using the option buttons, and save your changes by using the Set main button. This is shown in the following screenshot:

Class default language

Content translation

As for the content classes, we can translate any content object created in the CMF. To do this, we need to open the Content structure tab, and choose the object that needs to be translated.

Content translation

We can now select which language we want to add to the document, and start working on it. After we publish our work by using the Send for publishing button, the new translation will be available on the site frontend, under the selected language.

URL translation

When we translate a content object, its main URL will change accordingly. But we should only need to create aliases for a single language. For example, we should create an alias for the contact page in the staff section of the site only for the Italian version.

URL translation

As the first step, we need to open the Content structure tab. Next, from the Sub items box of the home page, we need to click on the icon for the Contact Us content object.

URL translation

The context menu will appear. Here, we have to select the Advanced | Manage URL aliases link.

URL translation

We can add a new URL alias by entering the new URL manually and selecting the relative language.

Tip

When we create a complex URL alias based on the pre-existing URL path, we have to remember that the existing objects or functionality with the same name will take precedence over the alias name.

..................Content has been hidden....................

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