Blog

On this page you will find Tutorials, How-Tos and Tips for developing with open bi.

Add multi-language support to your CMS

This blog post shows you one of the advanced functions of CMS on open bi.

If you want to make the pages and content of your CMS available in multiple languages, you can add multi-language support easily:

  • The CMS supports different languages by creating pages in the CMS role or CMS HTML Item Templates for these languages.
  • It is also possible to create small text snippets called Language Texts which can be included with Razor. Read more about using Razor in this blog post.

The language of the client is automatically detected by inspecting the "Accept-Language" request header. It can also be changed manually with the <openbi:changelanguage> HTML item.

Translate Role Content / HTML item templates

In the open bi Configurator while editing a Role Content or HTML item template in the CMS view, it is possible to create a copy of it for a specific language:

Simply select the desired language from the list...

...and the new language-dependend page is shown as a child of the default page. You can edit its content by double clicking on it.

If no specific page is found for the user's browser language, the standard page is returned.

Translate specific texts

To create a new language text open the open bi Configurator and go to the CMS view. Click on the context icon next to Language Texts and choose Add:

Enter a Id and confirm your entry:

Then add as many languages as you need by clicking on the context icon of the newly created text id...

... and selecting the desired language from the list:

Double click on the newly created language text to edit its content:

You can now include the language specific text into your page with this Razor expression:

@ViewBag.Translate("test")

Alternatively, you can also use the <openbi:translate> HTML item:

<openbi:translate data-languagetext-id="Test"></openbi:translate>

If you are performance sensitive, we recommend using the HTML item alternative over the Razor alternative, as it is faster!

Thilo Knötzele
Author: Thilo Knötzele
Creation date: 07.07.2021
Category: Web Development
back to overview