Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

Introduction

The general principle of "duplicating" an entity in a context different from that of origin is called "declination".

Translation is the general principle of "duplicating" an entity in a different language context than the original one.

This section describes the different declination principles where language is the only variable.

For all variations with regard to the concept of a project, please refer to the section "Project variations".

The principle of translation respects the following laws:

  • an entity is translatable if it has the master and lang fields: the value of the lang field is different for each translation

  • a user can create and declassify entities only in the languages of which it has rights in contribution: this information is stored at user level on the contriblangs fields

  • a user can translate an entity if he has the necessary rights to view it and if he can create it in the target language. It must therefore have access to at least two languages as a contribution

  • within the framework of objects that can be declined by project:

    • if the source entity belongs to a project, the project must be in the target language: the project must therefore be multilingual

    • an entity that can be applied to projects of the same group can only be translated in this specific context. It is not possible to translate an entity and translate it into another project at the same time with this function

All the translations of the same instance are presented in a "translations" tab accessible from the visualization action.

Prerequisites for translation

To be able to translate content, you must have the following components installed:

  • an object to be translated must inherit from the object contentobject at least the following information:

    • property master

    • property lang

    • property mediagroup (not required)

    • property media (not required)

    • property notranslation (not required)

  • the product plugin WXM_Mediacore must be enabled and the parameter isTranslationActive must be set to yes

Do a translation

In the back-office, the "translate" functionality allows you to easily perform a translation from the visualization of an object:

In the toolbar, click on "Translate":

then select the language in which your object should be translated.

Ignoring the principle of translation

It is possible to ask the system to ignore the notion of language on an entity. For example, as part of an object storing images, these are not necessarily language-specific (no text displayed) it must therefore be the same body for all languages.

In this case, if the object structure has the property notranslation and this one is set to yes (value 1), then the object will be considered untranslatable:

  • the translate button will not appear in the back office

  • an error is raised if you try to translate it with the action datatranslate

Caution

The value of the lang field will always be filled with the value of language of creation. Unlike the media field, the system does not handle objects whose lang property is empty.

Updating of allocations

During the translation action, the system creates a new object for the selected language context by duplicating the source and changing some properties automatically:

  • the language will be the target language

  • if the object to be translated is linked to other object instances via the attribution concept (child, childmulti) and these objects are also translatable, the system will automatically retrieve equivalent translations to update the property

Caution

If no matching object is found in the desired context, the property will be empty. This implies that if the property is required by its structure configuration, an error will be removed and the translation action canceled. (see article on standard errors).

Caution

We don’t do a cascade translation: if you want this kind of behaviour you need to customize it.

Manually configure a property during translation

You can manually overload a property during translation.

Indeed, creating a translation using the WmsUtils module, we pass in parameter a java.util.HashMap with the values that will be object as well as a java.util.HashSet of the objects in the new object collection not to be duplicated (e.g. paragraphs).

The translation action is datatranslate. When creating a translation, we call the following JSPs:

/bov3/datatranslate/initNotCopiedObjects.jsp

initializes the java.util.HashSet objects not to be copied in cascade.
You can customize this JSP in your SAN this way:

<%@page pageEncoding="ISO-8859-15"%>
<%@taglib prefix="noheto" uri="/WEB-INF/noheto.tld" %>
<%@taglib prefix="c" uri="/WEB-INF/c.tld" %>
<%--
/san/bov3/datatranslate/initNotCopiedObjects.jsp
--%>
<%
java.util.Set notCopiedObjects = (java.util.HashSet) request.getAttribute("notCopiedObjects");
if (notCopiedObjects == null) {
notCopiedObjects = new java.util.HashSet();
}
/*
 collections of' frontlink' type objects are not duplicated during translation;
*/
notCopiedObjects.add("frontlink");
/*
 we do not duplicate the collections of paragraph objects when translating;
*/
notCopiedObjects.add("paragraph");

request.setAttribute("notCopiedObjects", notCopiedObjects);
%>
/bov3/datatranslate/initForcedValues.jsp

initializes the java.HashMap utility and iter on each object’s properties to overload them when copying.
You can customize a field in two ways:

  • if you specify the name or position of the property as a key: you will overload the property globally, i.e. it will be applied regardless of the nature of the object.

  • if you specify as key[object name].property name or index: you will overload the property in a fine way, i.e. it will be applied only for the nature of the specified object.

Example
<%@page pageEncoding="ISO-8859-15"%>
<%@taglib prefix="noheto" uri="/WEB-INF/noheto.tld" %>
<%@taglib prefix="c" uri="/WEB-INF/c.tld" %>
<%--
/san/bov3/datatranslate/initForcedValues.jsp
--%>
<%
java.util.Map forcedValues = (java.util.Map) request.getAttribute("forcedValues");
if (forcedValues == null) {
forcedValues = new java.util.HashMap();
}
/*
During a translation, we always want to empty the product's capacity so that
the user re-enters the contance in Onces (Oz) or Millilitres (ml) of the product.
*/
if (!forcedValues.containsKey("capacity")) {
forcedValues.put("capacity", "");
}
request.setAttribute("forcedValues", forcedValues);
%>

You can also customize properties by fields by overloading properties in this way:

  • [objects/[object_name]]/bov3/datatranslate/forcedvalues/properties/[property native type]/[nature]/[property name].jsp

  • [objects/[object_name]]/bov3/datatranslate/forcedvalues/properties/[property name].jsp

  • [objects/[object_name]]/bov3/datatranslate/forcedvalues/properties/[property native type]/[property type].jsp

Within these JSPs, you can work with the following variables:

form_object

nature of the current object in translation short

activeRefererObject

reference object under translation

itemValue

CTObjectField corresponding to the current property

colfield

name of the current property

nature

nature of the object pointed out in the context of an attribution relationship

forcedValues

java.util.HashMap properties to force properties to force

Standard errors

When translating from dataview, errors are displayed via the standard popup.

Here are the error codes you may encounter:

not_connected

Your session has expired, you need to log in again.

object_not_found

The object to translate does not exist.

not_authorized

You don’t have the necessary rights to see the instance.

  • This feature is reserved for variations in the same project: The source project must therefore be accessible since we are going to create an version in this same project.

  • The destination language must be accessible to the user, check that they have good access to this one.

  • Security is tested in the init of the datatranslate action, by default we test the action view of the objectdata domain, check the security rules or override this boolean with a rule specific to your developments.

not_compliant

the requested object does not have the necessary properties for the translation function (at least the master and lang fields)

object_no_translation_selected

the object has been specified as untranslatable via the notranslation property

mandatoryFields

the object could not be created because some mandatory fields are empty. This error is often solved because a match could not be found on an association.
The value associated with this error is the list of fields that are empty.

  • associations must be translated before translating the requested object

  • the error is raised by a structural obligation. If this obligation is only functional, you can create a facet to render it mandatory only as a back-office contribution

  • Customize the field to manage a default value.

FAQ

Why is the Translate button not available on my item or a message tells me that the feature is not available?

If the object does have properties listed in the pre-required section check the following points:

  • Check that the user performing the test has several contribution languages

  • Does the object belong to a project (media completed)?

    • If yes, then make sure that the project is available in several languages and that there is more than one language in common with the user’s languages. The "Translate" button does not appear if the user has no "destination" languages for translation.

Why do I always get an error telling me that a field is not filled in when I translate?

The user tries to translate an object whose structure is defined as a obligatory attribution to another object that can also be translated. However, when translating, the system searches for a match to these documents in the language of destination. Since he finds none, the property will be empty in the translation, which is not allowed.

To solve this problem, you have three main solutions:

  • This link is mandatory for a reason (data model, technical, functional needs): the user must translate these other linked objects before translating the object that raises the error.

  • You can customize the property that clears the error to assign a Default value (to be defined in the specifications) in this case.

  • If binding was mandatory only in a functional setting, you can change your object configuration to make the field mandatory only through one facet (and more in the structure) the obligation will be carried out in the back office forms but this one will not be tested during the translation process.

    Warning

    If you apply this solution, the new object will not be functionally valid which can be disturbing for the user.

  • No labels