Content in dotCMS, including Pages, can be created in many languages. When a user accesses content using a specific language, if a version of that content exists in the appropriate language, the appropriate language version of the content is displayed.
However if the user attempts to access content using a specific language, but no version of the content exists in that language, you must choose how to handle the request. For example, if your Site supports English, Spanish, and French, but you have content which has only English and Spanish versions, you must decide how the system handles it when a user attempts to access the content in French (since no French version of the content exists yet).
Options
When a user attempts to access a piece of content in a language for which no version of the content has been created, there are two different ways to handle it:
- Don't display the content, since the expected language version of the content does not exist.
- Have the content “fall-through” to the default language, and display the default language version of the content instead.
You can separately control how dotCMS handles this for Pages, Content other than Pages, and Widgets. The default behavior for each of these types of Content is different, and each of these behaviors is controlled by a separate system property in the dotmarketing-config.properties file.
Note: It is strongly recommended that all changes to the dotmarketing-config.properties file be made through a properties file extension.
Pages
By default, a version of a Page in the default language will be displayed if there is no version of the Page in the current display language. To change this behavior, change the DEFAULT_PAGE_TO_DEFAULT_LANGUAGE parameter in the dotmarketing-config.properties file:
DEFAULT_PAGE_TO_DEFAULT_LANGUAGE=true
If this property is set to true (the default value), then if there is no version of the Page in the language the user attempts to display, the default language version of the Page will be displayed to the user instead.
If this property is set to false, then when a user attempt to access a page when an appropriate language version of the page doesn't exist, the user will receive a 404 error.
Content
By default, content other than Pages is not displayed if there is no version of the Content in the current display language. To change this behavior, change the DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE parameter in the dotmarketing-config.properties file:
DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE=false
When this property is set to false (the default value), content will not be displayed if there is not a version of the content in the current display language. Note that this could potentially lead to blank pages or blank portions of a page.
If this property is set to true, then if there is no version of the Content in the language the user attempts to display, the default language version of the Content will be displayed to the user instead.
Widgets
Widgets can be set to have language versions just like any other content, or be set to persist on a Page regardless of the language set in the session.
By default, the same widget needs to be placed on each language version of the Page. To allow widgets to persist (like forms), on a Page, regardless of the language version, change the DEFAULT_WIDGET_TO_DEFAULT_LANGUAGE parameter in the dotmarketing-config.properties file:
DEFAULT_WIDGET_TO_DEFAULT_LANGUAGE=true
When this property is set to true (the default value), the widget does not display on every language version of the Page, so you must place widgets on each version of the Page so the widget can be customized per language session.
If this property is set to false, the same widget persists on all language versions of a Page and needs to be placed on that Page only once (an any language version of the Page). If this setting is used, then the velocity that pulls the content in the widget needs to be smart enough to pull any language version of the content that has been already set in the session.