opencms

OpenCms 8 language support


I am trying to build a multilingual website (German and English). My first intuitive approach was to use the language selector in each article and structural element in order to create my content in both languages.

The problem is that I don't know how to switch the language. How can tell OpenCms to use the German version of an article? Where can I set the default-language?


Solution

  • OpenCms uses the locale-property of a resource to know in which language the content should be displayed.

    To take advantage of this, you can create your content in a folder /en/ (e.g. /en/page1.html /en/about.html) and set the locale-property of the /en/ folder to "en".

    You should add content in the other language as well.

    To finalize the multi-language setup, you copy the folder /en/ to /de/

    Make sure to chose "Copy no resource, just create siblings of all resources in the folder".

    Then you set the locale-property of the /de/ folder to "de".

    This way OpenCms knows in which language the content must be served.

    When you create a new file (in any of /de/ or /en/) do not forget to copy it as sibling to the other folder.