Languages

Catalogue components, the converter and both viewers include the same fourteen languages as the site. Built-in translations cover controls and skin cautions, not resource names or author descriptions. Applications can select a language through normal HTML inheritance, override a small set of product labels, or provide a complete dictionary for another language.

Select a built-in language

Supported tags are en, ru, zh, es, pt, de, fr, ja, ko, uk, tr, pl, it and nl. Regional tags use their base language: de-AT selects German. An unsupported tag selects English. Set lang on an individual element only when it must differ from its surroundings. This applies equally to standalone blocks, a composed catalogue and 3D viewers. The dictionaries are part of the package and need no separate download.

Follow the page while it changes

Without its own lang, an element observes its nearest language-bearing parent, across Shadow DOM and up to <html>, then uses the browser language if none is present. Changing a wrapper or document language refreshes existing controls without reloading the application. Viewers retain their file and camera. An explicit language on the element wins, so remove that attribute before expecting it to follow the page. Registration and observer cleanup are handled by the components.

document.documentElement.lang = 'ja';
// No element.lang is needed when it should follow its parent.
viewer.removeAttribute('lang');
document.documentElement.lang = 'de';

Replace labels through words

Assign a partial CatalogWords object to words for product-specific terminology. Missing top-level fields retain the selected built-in language. Nested objects such as tabs, sorts and clipNames are replaced as whole objects; spread the corresponding wordsFor(language) value before changing one entry. Count labels are functions, not templates interpreted by the component. The complete catalogue forwards its overrides to nested blocks; independent blocks need their own assignments.

import { wordsFor } from 'mosaicary/catalog';
const base = wordsFor('de');
catalogue.words = {
  search: 'Suche im Katalog',
  tabs: { ...base.tabs, skins: 'Unsere Skins' },
};

Provide another language consistently

For an unsupported language, build a complete dictionary using the exported CatalogWords type. Starting from wordsFor("en") is a practical template, but untranslated entries remain English until replaced. Use Intl.PluralRules for quantity-dependent forms and locale-aware number formatting inside count functions. Assigning words again refreshes controls and preserves loaded viewer content. Keep source resource names and descriptions separate from interface dictionaries so attribution and author text are not rewritten accidentally.

import { wordsFor } from 'mosaicary/catalog';
const rules = new Intl.PluralRules('sv');
catalogue.lang = 'sv';
catalogue.words = {
  ...wordsFor('en'),
  search: 'Sök',
  entities: (n) =>
    n.toLocaleString('sv') +
    ' ' +
    (rules.select(n) === 'one' ? 'entitet' : 'entiteter'),
  // Translate all remaining CatalogWords fields.
};