Add a further language to an existing project

MichaelaReydt
Community Manager
Community Manager
2 1 444

FirstSpirit supports multilingual projects. So it could be necessary to add a further language to an existing project.

This blogposting explains the necessary steps involved:

  1. Create the new language
  2. Add the new language
  3. Edit the templates
  4. Edit the content
  5. Media
  6. Finalize


Create the language


Before a language can be added to a project, it first of all has to exist on the FirstSpirit server. Open the server and project configuration and go to the menu-tab Language templates inside the server properties.

3.png

Clicking the button Add opens the following dialog box (see picture below). The red text indicates mandatory fields. It changes to black as soon as the fields are filled.

1.png

Name: The name of the language.

Abbreviation: Definition of an abbreviated name for the language. It will be displayed in the language tabs within FirstSpirit. The following characters can be used: -, _, 0-9 and A-Z.

Language: Specification of the two-letter ISO-639 based code for the new language. Only lowercase letters may be entered.

After the new language is added to the server it can be used in every project on the server. But therefore it has to be embedded in the particular project.

Add the new language

The menu-tab Languages inside the project-properties contains a list of all languages which are already used in the project. A right mouse-click in this overview opens a context menu with i.a. the menu-item New.

2.png

By clicking on this entry a list of all available languages appears and the new language can be selected.

If a new language is added, all stores (Page-, Site-, Media- and ContentStore) are re-released in the client. In the case of large projects with a lot of media ( > 1000 or mediastore.xml file ~ 1 MB) it is important to make sure that there is sufficient memory available for this action.

If one or more generation tasks are available for the project the following dialog willl appear. It asks for a decision whether a generation should be executed for the new language.

generate_language_global.png

After this question the configuration dialog will be displayed again. It is filled with the information under which the language has been integrated in FirstSpirit in the first step (see above: Create the language).

By clicking the button OK the new language will be added to the project. If it also should be used for the existing and not only for the further content within the project, some changes are needed inside the project itself.

Edit the templates

The new language is reflected in the templates in form of a new language-tab. The form fields inside this tab are labeled in the default language (which is usually English), because the template contains no LANGINFO-tag for the new language.

4.png

To show the form fields also in the new language the related LANGINFO-tag just has to be added. This tag could f.i. look like this:

<LANGINFO lang="ES" label="Texto" description="Llene la información del producto"/>

If some labels still appear in another the language, the JavaClient has been started in this other language. To change this effect, the language at the FirstSpirit startpage has to be changed before the JavaClient is started.

JC_language.PNG

Edit the content

PageStore

As described before the new language is reflected in the project in form of a new language-tab. Each of these new language-tabs is empty and needs to be filled with content.

Furthermore the tab has to be marked as "completely translated" in the PageStore. With a click in the little circle next to the label of the tab a tick appears, which marks the page as translated.

page_translated_small.png

ContentStore

To add the new language to the ContentStore, three steps are needed:

  1. Edit the database schema
  2. Edit the mapping
  3. Edit the entities in the data sources

Database Schema

By adding the new language to the project also each entity in the data sources of the ContentStore gets a new language-tab. But any language-dependent input in the form of these tabs won't be saved as long as the related database doesn't know how to handle it and as long as no mapping exists.

So the database first of all needs to be extended for all language-dependent fields. The easiest way for this is to edit the xml-structure. The menu-item "edit externally", which is only accessible when the database is in edit-modus, displays the xml-schema in an external dialog.

5.png

The xml-schema contains a lot of lines with values ending on DE or EN:

<xs:element dbName="HEADLINE_EN" javaType="java.lang.String" length="64" name="Headline_EN" nullable="1" type="xs:string"/>

For each of these lines a further line has to be added for the new language, f.i.:

<xs:element dbName="HEADLINE_ES" javaType="java.lang.String" length="64" name="Headline_ES" nullable="1" type="xs:string"/>

By saving these changes the database will be extended.

6.png

Mapping

In the next step the mapping of the table templates must be adjusted, so that each language dependent variable is assigned to the table column for the new language.

7.png

Entities

Now the language-tabs of the entities in the data sources of the ContentStore can be filled with the content. It will be saved in the new fields of the related database.

GCA (global configuration area)

In the GCA general labels - like headers or footers - or specific custom content can be defined, which are used at several points inside the project. These labels and all custom content should be available in the new language as well.


The link for switching the language inside the Mithras-project is a good example. This link comes up with a specific icon for each language, which is missing for the new language.

gca_language_icon_missing.png

A look at the template-code shows, that this icon has to be named "icon_" + _lang.abbreviation.upperCase" (f.i. Spanish: icon_ES).

lang_icon.png

If the link should be visible with a specific icon for the new language, it has to be added to the MediaStore.

Media

Media can be language dependent or independent. Language independent media don't need to be changed, but the dependent media should be customized to fit the new language. They are recognizable by their icons, which contain a small "B" in their top-left corner.

media_language_dependent.PNG

As the form fields in the PageStore the new language-tabs of these media are empty and should be filled with content. Therefore a new medium can be uploaded, while the related language-tab is selected.

Finalize

At the end of these steps a full deployment makes the new language also visible at the website, if the tasks were configured to generate the new language.

1 Comment