Default Language Fall-Through

Last Updated: Jul 23, 2020
documentation for the dotCMS Content Management System

If a user attempts to access content in dotCMS in a particular language, but the content does not exist in the specific language requested, dotCMS may either show the content in the default language or may show nothing or return a 404 error (ensuring that dotCMS only shows content in the specific language requested).

The ability for dotCMS to show content in the default language is called the default language fall-through, and can be configured differently for different types of content.

Configuration Properties

The fall-through configuration for different content types is specified via several language properties set in the dotmarketing-config.properties file, allowing you to customize the fall-through behavior. The following are the default values of the fall-through properties:

##  if this variable is set true and the contentlet you are looking is not in the language you are on,
##  this will show the contentlet in the default language (Fall-thru to the default language). If is set to false
##  this aditional search is avoided
DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE=false

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Widgets
DEFAULT_WIDGET_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Pages
DEFAULT_PAGE_TO_DEFAULT_LANGUAGE=true

## it is similar to DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE but only applies for Files
DEFAULT_FILE_TO_DEFAULT_LANGUAGE = true  

So by default, Widgets, Pages, and Files will display in the default language if the requested language version does not exist, but individual content items will not display in the default language if the request language version of the content doesn't exist.

These properties are handled independently. So, for example, with the default configuration, pages are set to fall-though to the default language, but content is not. This means that if a user attempts to access a page in a language that the page has not been translated to, the default language version of the page will display. However if the content which is displayed on the page has not been translated then the page will be blank (not showing any content), since the content does not exist in the specified language and content is not set to fall-through by default. To change this behavior and ensure that content is always displayed (even if it hasn't been translated yet), change the DEFAULT_CONTENT_TO_DEFAULT_LANGUAGE property to true.

Overriding Fall-Through Properties

The language fall-through properties will not be applied if the language_id property is supplied when retrieving the content (whether simple content, Pages, Files, or Widgets).

When you specify the language_id parameter, you are requesting a specific version of the content, and dotCMS will supply only the specific version you requested. If that language version of the content does not exist, the content will not display or you will receive a 404 error, depending on the context in which you are asking for the content.

If you wish to ensure that the fall-through properties are respected, it is recommended that you set the com.dotmarketing.htmlpage.language property in the user's session. For more information, please see the Multi-Site Language Configuration documentation.

On this page

×

We Dig Feedback

Selected excerpt:

×