Multi language

Making fields Multi Language in Open Content

Open Content allows you specify which fields of a template are Translatable by the editor. The idea behind this is that you can have users translate texts, but not images for instance. There is no "make all fields Multi Language (ML)" setting.

Most fields can be defined as a multi language field by using a specific field type in the Options file in the Template folder.
As an example, if you want a field of type "text" to be ML, you set the type to "mltext"

Multi language fields will have a flag of the current language on the right top in the Editors interface.

Edit formEdit form

Edit form

Available field types

  • Multi lingual Text : mltext
  • Multi lingual CKeditor : mlckeditor
  • Multi lingual wysihtml : mlwysihtml
  • Multi lingual url : mlurl
  • Multi lingual Image : mlimage
  • Multi lingual File : mlfile

Example

{
  "type": "object",
  "properties": {
    "Title": {
      "type": "string",
      "title": "Title"
    },
    "Text": {
      "type": "string",
      "title": "Text"
    }
  }
}
{
  "fields": {
    "Title": {
      "type": "mltext"
    },
    "Text": {
      "type": "mltext"
    }
  }
}

Localization of templates

  1. Add your translations in localization files (Edit Template Files)
{
  "key1":"texte 1 in french",
  "key2":"texte 2 in french"
}
{
    "key1":"texte 1 in dutch",
  "key2":"texte 2 in dutch"
}
  1. Add the texts to your template
{{Localization.key1}}
@Model.Localization.key1

🚧

Handlebars Static Localization

The localization variable is on the root. So if you localize text in a each.
Don't forget to get the variable of the parent context {{..//Localization.key1}}

📘

Razor Static Localization

You can access the static text localization using: @Model.Localization.key1