IafViewer internationalization
Overview
The IafViewer can show its chrome in 17 languages. Chrome covers the toolbar, tooltips, notifications, settings, model composition, cutting planes, tagged list, markup, learning center, snapshot, model tree, 2D sheets, and GIS.
The viewer ships English plus 16 other catalogs. The chrome stays in English until your application sets the i18n prop. The viewer doesn't detect the browser language (navigator.language) and doesn't support right-to-left (RTL) layouts.
The i18n prop only localizes the viewer chrome. Your application localizes the page around the viewer.
For the full prop reference, see IafViewer — i18n. IafViewerDBM forwards the same i18n prop.
Localizing the viewer
To show the viewer chrome in another language, complete the following steps:
- Set
i18n.localeto a host tag from the Supported locales table, for example'ja-JP'. - Optional: To change specific strings, add overrides in
i18n.messages. - Optional: To use your own font stack, set
i18n.fontFamily. - Optional: To add fonts to the markup Style dropdown, list them in
i18n.fonts.
<IafViewerDBM
i18n={{
locale: 'ja-JP',
messages: { tooltips: { ResetView: 'Restore the default 3D view' } },
fonts: [{ label: 'Brand Sans', value: '"Brand Sans", system-ui, sans-serif' }],
}}
/>
The viewer applies the i18n prop on mount and whenever the prop changes. Your values override the PropertyStore defaults.
i18n props
| Prop | Default | Description |
|---|---|---|
i18n.locale | 'en' | BCP 47 tag. The language subtag selects a shipped catalog, so ja-JP selects ja. Unsupported tags and missing keys fall back to English. |
i18n.messages | {} | Nested overrides, deep-merged onto the shipped catalog for the selected locale |
i18n.fontFamily | undefined | CSS font-family stack that replaces the locale-derived stack |
i18n.fonts | [] | Extra { label, value } font choices for the markup Style dropdown |
Supported locales
The catalog is the language. When the viewer ships the language, it keeps the region for number and date formatting. Chrome numbers use Western digits (latn).
| Region | Language | Catalog | Host tag | Script |
|---|---|---|---|---|
| — | English | en | en | Latin |
| Asia | Japanese | ja | ja-JP | CJK |
| Asia | Korean | ko | ko-KR | Hangul |
| Asia | Chinese (Simplified) | zh | zh-CN | CJK |
| India | Hindi | hi | hi-IN | Devanagari |
| India | Telugu | te | te-IN | Telugu |
| India | Tamil | ta | ta-IN | Tamil |
| India | Kannada | kn | kn-IN | Kannada |
| India | Marathi | mr | mr-IN | Devanagari |
| India | Gujarati | gu | gu-IN | Gujarati |
| India | Malayalam | ml | ml-IN | Malayalam |
| India | Bengali | bn | bn-IN | Bengali |
| Europe | German | de | de-DE | Latin |
| Europe | French | fr | fr-FR | Latin |
| Europe | Spanish | es | es-ES | Latin |
| Europe | Italian | it | it-IT | Latin |
| Europe | Portuguese (Brazil) | pt | pt-BR | Latin |
Message overrides
i18n.messages is a nested object with the same shape as the English catalog. It isn't a flat map of dotted keys such as "common.confirm". Include only the keys you override, and keep any {placeholders} unchanged.
To discover the available keys, read the English catalog from IafI18n.catalog:
import { IafI18n } from "@dtplatform/iaf-viewer";
// IafI18n.catalog — stable English tree for key discovery
The catalog has these namespaces: common, tooltips, toolbar, notifications, gis, settings, composer, cuttingPlanes, taggedList, markup, learningCenter, snapshot, modelTree, viewer2d.
messages: {
common: { confirm: "OK" },
tooltips: { ResetView: "Restore the default 3D view" },
toolbar: { groups: { defaultTools: "Main tools" } },
notifications: { notifyLoadingGraphicsResources: "Loading graphics…" },
gis: { bearing: "Bearing" },
settings: { cacheSettings: "Cache settings" },
composer: { title: "Model composition" },
cuttingPlanes: { showPlanes: "Show planes" },
taggedList: { search: "Search" },
markup: { font: { system: "System" } },
learningCenter: { title: "Learning center" },
snapshot: { title: "Snapshot" },
modelTree: { toolbar: { select: "Select" } },
viewer2d: { sheetNames: "Sheet names" },
}
Fonts
When you omit fontFamily, the viewer uses Inter, system-ui, sans-serif, plus a script hint for non-Latin locales. The viewer doesn't bundle Noto fonts.
A non-empty fontFamily replaces that stack, so include fonts that cover the script:
fontFamily: 'Inter, "Noto Sans Tamil", "Tamil Sangam MN", "Nirmala UI", Latha, system-ui, sans-serif'
The markup Style dropdown lists System (the resolved fontFamily), monospace, and arial, followed by your fonts entries. The viewer ignores entries without both label and value.
fonts: [
{ label: "Brand Sans", value: '"Brand Sans", system-ui, sans-serif' },
{ label: "Japanese", value: '"Hiragino Sans", "Noto Sans JP", sans-serif' },
]
What to localize
| Localize | Leave as stored or in Latin script |
|---|---|
| Viewer chrome (toolbar, settings, GIS chrome, markup UI, composer display labels, cutting-plane UI, tagged list, notifications) | Model _name, view titles from the model, IFC and Revit types, unit symbols |
Your product wording, through messages | LayerType plugin IDs, equality keys, query tokens such as is:tagged |
Discipline labels (composer.discipline.*) | The English LayerType values that those labels are keyed by |
Toolbar layout
The large toolbar button is 94 × 56 px. Localized titles wrap to at most two lines inside the hover and selected highlight. The tooltip shows the full string. Don't shorten translations to match the English width.
Related examples
The IafViewerExI18n example in the IafViewer Examples view shows locale switching, message overrides, and fonts.
To change the language of the Examples gallery itself, add ?locale= to its URL. This setting only affects the gallery shell. An example viewer uses it only if the example passes the i18n prop.