|
| 1 | +--- |
| 2 | +title: Localization |
| 3 | +description: Set the language for embedded Cube surfaces β account-wide, per embed via URL, or at runtime. |
| 4 | +--- |
| 5 | + |
| 6 | +Embedded Cube surfaces β dashboards, [Analytics Chat](/embedding/iframe/analytics-chat), |
| 7 | +and the full app in [Creator Mode](/embedding/iframe/creator-mode) β can render their |
| 8 | +UI in any of the supported languages. You can set a default language for the whole |
| 9 | +account, override it per embed with a URL parameter, or switch it at runtime from the |
| 10 | +host page. |
| 11 | + |
| 12 | +<Note> |
| 13 | + Available on [Premium and Enterprise plans](https://cube.dev/pricing). |
| 14 | +</Note> |
| 15 | + |
| 16 | +## Supported languages |
| 17 | + |
| 18 | +| Language | Locale code | |
| 19 | +| -------------------------- | ----------- | |
| 20 | +| English (US) | `en-US` | |
| 21 | +| Deutsch (Deutschland) | `de-DE` | |
| 22 | +| EspaΓ±ol (EspaΓ±a) | `es-ES` | |
| 23 | +| EspaΓ±ol (LatinoamΓ©rica) | `es-MX` | |
| 24 | +| FranΓ§ais (France) | `fr-FR` | |
| 25 | +| Italiano (Italia) | `it-IT` | |
| 26 | +| ζ₯ζ¬θͺ (ζ₯ζ¬) | `ja-JP` | |
| 27 | +| Norsk bokmΓ₯l (Norge) | `nb-NO` | |
| 28 | +| PortuguΓͺs (Brasil) | `pt-BR` | |
| 29 | +| PortuguΓͺs (Portugal) | `pt-PT` | |
| 30 | +| Svenska (Sverige) | `sv-SE` | |
| 31 | +| TiαΊΏng Viα»t (Viα»t Nam) | `vi-VN` | |
| 32 | + |
| 33 | +English (`en-US`) is the default and the fallback when no language is configured. |
| 34 | + |
| 35 | +A locale value can be a full code (`es-ES`), a short language code (`es`), or a regional |
| 36 | +variant that isn't shipped (`es-AR`). Short codes and unsupported regional variants |
| 37 | +resolve to the first supported locale for that language β for example, both `es` and |
| 38 | +`es-AR` resolve to `es-ES`. A value that doesn't match any supported language is ignored. |
| 39 | + |
| 40 | +## How the language is resolved |
| 41 | + |
| 42 | +The language of an embedded surface is resolved from the following sources, highest |
| 43 | +priority first: |
| 44 | + |
| 45 | +1. **Runtime override** β a [`cube:action:set-locale`](/embedding/iframe/events#cube-action-set-locale) |
| 46 | + message sent from the host page (see [At runtime](#at-runtime)). |
| 47 | +2. **URL parameter** β the `?locale=` query parameter on the embed URL (see |
| 48 | + [Per embed via URL](#per-embed-via-url)). |
| 49 | +3. **Account default** β the language configured in **Embed β Settings** (see |
| 50 | + [Account-wide default](#account-wide-default)). |
| 51 | +4. **Fallback** β `en-US`. |
| 52 | + |
| 53 | +## Account-wide default |
| 54 | + |
| 55 | +Set a default language for all embedded surfaces from the Cube Cloud console: |
| 56 | + |
| 57 | +1. Go to **Embed β Settings**. |
| 58 | +2. In the **Language** card, pick a language from the dropdown. |
| 59 | + |
| 60 | +The selected language applies to every embedded surface across the account, unless a |
| 61 | +specific embed overrides it with a `?locale=` URL parameter or a runtime |
| 62 | +`cube:action:set-locale` message. |
| 63 | + |
| 64 | +Clearing the setting removes the stored default, and embeds fall back to `en-US` (or to |
| 65 | +whatever a per-embed override specifies). |
| 66 | + |
| 67 | +## Per embed via URL |
| 68 | + |
| 69 | +Override the account default for an individual embed by adding the `?locale=` query |
| 70 | +parameter to the embed URL: |
| 71 | + |
| 72 | +```text |
| 73 | +https://your-tenant.cubecloud.dev/embed/dashboard/YOUR_DASHBOARD_PUBLIC_ID?session=YOUR_SESSION_ID&locale=es-MX |
| 74 | +``` |
| 75 | + |
| 76 | +The parameter is read once when the embed loads and pinned for the session, so in-app |
| 77 | +navigation won't drop it. |
| 78 | + |
| 79 | +## At runtime |
| 80 | + |
| 81 | +Switch the language after the embed has loaded by sending a |
| 82 | +[`cube:action:set-locale`](/embedding/iframe/events#cube-action-set-locale) message from |
| 83 | +the host page. This takes precedence over both the URL parameter and the account default: |
| 84 | + |
| 85 | +```js |
| 86 | +sendAction("cube:action:set-locale", { locale: "es" }); |
| 87 | +``` |
| 88 | + |
| 89 | +See [Events and actions](/embedding/iframe/events) for the full host β embed messaging |
| 90 | +contract. |
0 commit comments