Table of Contents

Multilanguage Data

you are here (click to zoom) - discover the stack

Data in 2sxc is Multi-Language by default, but the UI will only offer languages which have been activated in the Site settings.

Multi-Language Attributes

Every Attribute (like a Title) can be stored in multiple languages. So the data model of some content can look like this:

  1. Title
    • en-US: Enjoy a Visit to our Headquarters
    • de-DE: Genießen Sie einen Besuch in unserem Hauptquartier
    • de-CH: Geniessen Sie einen Besuch in unserem Hauptquartier
  2. Photo
    • *: file:7402
  3. SloganImage
    • en-US: file:7405
    • de-DE,de-CH: file:7406
  4. GpsCoordinates
    • en-US: { "Long": 74.6020030, "Lat": 53.002030060 }
  5. Employees (reference to other entities/items)
    • *: [74, 592, 6030, 39]

Some things to understand in the above data model:

  1. Title is translated in 3 languages (Germany/Switzerland only differing with ß vs ss)
  2. The Photo has the language * which means that it was edited before languages were enabled and doesn't map to any particular language
  3. The GpsCoordinates are only set in 1 language, so every language will show the same value
  4. The SloganImage is translated so en and de have different images
  5. The Employees relationship to other data is not translatable, and the order of the items is also preserved

Language Assignment and Read/Write State

Each Attribute or Property like Title has one or more Values.

  • These Values are mapped to the Attribute with one or more languages.
  • Each language-assignment also stores the read/write state for the UI.

As such, a value can have different internal rules

  1. It can be assigned to one language only.
  2. It can be assigned to multiple languages and editable in the UI of each language. Changing it would change the value in all the languages.
  3. It can be assigned to multiple languages and editable in the UI of some of these languages. Changing it (in one of the editable languages) would change it in all assigned languages. The assigned languages which are not editable would always just show this language, but not enable editing in the UI.

Relationships Cannot be Translated

Relationships are not Translatable. If a Blog-Post references Tags, the same tags are referenced in all languages. Note that related items may again have multi-language properties, so even if the Authors list contains the same authors across languages, accessing the Bio of a related Author will probably return a different value.

Assets are Multi-Language, but the Files are Shared Across Languages

A link/file-field can have a different value in each language, but the files uploaded will be available to that field in the UI of every language. So a SloganImage field would show all the files that were uploaded to this field, but the selected file can be different in each language.

This wil also affect Libraries of files - the libraries will always contain the same files/images in all languages. But if these files have Metadata, then that Metadata can be different in each language.

Disable Translation for Individual Fields

The UI can be configured to not allow translation of specific fields if this is desired (for example URL-key fields). See also Basics.Cms.Languages.Index.

Internal Functionality

When languages are enabled, this is what happens

  1. Every field can be translated individually - or you can translate all fields of an Entity
  2. On every Entity the primary language must always be created first
  3. The primary language will then serve as the fallback for all languages which have not been translated
  4. In addition to translating values you can also link them to other languages, so that editing a value in de-DE would automatically affect de-CH but not en-US

History

  1. Introduced in 2sxc 2.0
  2. Non-Translatable fields were made an option in 2sxc 11