Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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


Warning
titleCaution

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


Warning
titleCaution

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).


Warning
titleCaution

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

...

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
    titleWarning

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