Skip to content
OpenCms documentation
OpenCms documentation

Language independent values

OpenCms stores a language specific value for each schema element. By default, each of the language specific values differ from each other. Using the synchronization mechanism described here, it can be enforced that the value of a schema element is the same for each language, i.e., if a value is altered in one language in the editor, the altered value is stored for all languages.

OpenCms supports multi-lingual contents and stores language specific values for each content element. For textual values, it is intended in most cases that the values differ for each language.

In some situations, though, it is desirable that content element values are the same for every language. For example, you might use the same image or the same date for each language of an event content.

To keep values identical—independent of the language—one can configure that an element's values should be synchronized. This means, if you change the value for one language in the editor, it is changed for all languages.

To force synchronization of content element values, use the <Synchronization> field setting. The content element to be synchronized is selected with an XPath expression such as Paragraph/Image/Image as shown in the example below:

Synchronizations must be specified in the root content XSD. In nested content XSDs, the specification is ignored.

Synchronization of values of schema elements is a feature of the content editor. You just configure the editor to synchronize values. That is, when in the content editor, a value is changed for one language, the values of the corresponding schema elements in all other languages (if the schema elements are present at all) are also changed. If you change a value in the source code, no synchronization is performed.

Configuring synchronized schema elements adds an extra option in the form-based content editor. Because usually synchronized schema elements can have different values in different languages if the source code of the XML content is edited, the form-based content editor provides an option "Synchronize" in the "Copy locale" dialog when synchronized values are configured. This will sync the language specific values to the value from the currently edited locale.