Modules / Multilingual

Multilingual: language conditions & templates

Multilingual: language condition and per-language templates

Show an element only in some languages, assign a header, footer or theme style to a language, and see each page's language in the builder's Pages panel. For Polylang (tested) and WPML (built to its API, not yet tested on a live WPML site). Bricks' own way to get a header or footer per language is to translate the template; the condition here is for when you'd rather keep separate templates.

#27 of 39 modules by votes

  • On by default
  • Needs Bricks 2.4 or newer, and Polylang or WPML
  • Tested with Bricks 2.4.3
Recording: the builder’s Pages list marks each page [EN] or [DE]; on the live site, someone switches from EN to DE and the German page opens with a bar shown only in German.Recorded in Bricks 2.4.3

How to use it

An element in one language only

  1. Select the element and open its Conditions.
  2. Add the condition Language from the Kiln group.
  3. Choose is or is not, then the language.

A header, footer or theme style per language

  1. Open the template's settings (or the theme style's Conditions).
  2. Add a condition and choose Language (Kiln).
  3. Pick one or more languages.

Where it appears in Bricks

  • Element conditions: Language, in the Kiln group.
  • Template conditions and theme-style conditions: Language (Kiln).
  • The builder's Pages panel: each page title starts with its language code, for example [DE] Startseite.

How Bricks combines conditions

Bricks scores every condition row of a template on its own and uses the highest score. Rows are combined with OR, so "Post type: Post" plus "Language: German" on one template means "any post, or anything in German", not "German posts". Make one template per language instead.

A language row scores 5. That beats "Entire website" (2), "All archives" (3) and "All terms" (4), and loses to a post-type condition (7) or a specific page (8 to 10).

Theme styles load one at a time by default: on a German page, a German-only theme style replaces your site-wide style completely, not just the settings it changes. Either copy the site-wide settings into it, or set Bricks > Settings > General > Theme styles: Loading method to Load all matching theme styles, so the German style only adds to the site-wide one.

Limits

  • Exclude is hidden on language rows: Bricks only lets its own conditions exclude.
  • On the front end, the condition uses the page's language. When WPML shows an English post at a German URL ("display as translated"), the German header and style apply.
  • Polylang is tested. WPML support follows WPML's documented API and has not been tested on a live WPML site yet.

Settings

None. The module is on by default when Polylang or WPML is active.

Requirements

Bricks 2.4 or newer, and Polylang or WPML.