Internationalization

How Vanilla Breeze handles script-specific typography, ruby visibility, locale-aware quotes, translate conventions, and locale resolution.

Philosophy

Internationalization is not a feature you add — it is a constraint you respect from the start. VB treats i18n the same way it treats semantic HTML: build it in, don't bolt it on.

The web platform already has most of what you need: the lang attribute, CSS :lang(), logical properties, the Intl API, the translate attribute, and ruby HTML elements. VB uses them correctly and consistently.

Script-Specific Typography

Set lang on any element and VB automatically applies the right font family, line height, letter spacing, and word-breaking rules. This works via CSS :lang() which inherits through the subtree.

Supported Scripts

ScriptLanguagesTokenLine Height
CJKzh, ja, ko--font-cjk1.8
Arabicar, fa, ur, ps--font-arabic1.9
Hebrewhe, yi--font-hebrew1.75
Thaith--font-thai2.0
Devanagarihi, mr, sa, ne--font-devanagari1.75

Font Token Slots

VB provides custom properties for each script family. Override them to load your preferred fonts:

Ruby Visibility

Control ruby annotation display with data-ruby on <html>:

ValueBehavior
showAlways visible
hideVisually hidden, kept in DOM for accessibility
autoVisible for CJK languages, hidden otherwise
(absent)Browser default

Locale-Aware Quotes

The <q> element renders locale-appropriate quotation marks via CSS quotes:

LanguageOuterInner
English (US)“...”‘...’
English (GB, AU, NZ)‘...’“...”
German„...“‚...‘
French« ... »‹ ... ›
Italian / Spanish / Portuguese«...»“...”
Polish«...»„...“
Japanese / Chinese「...」『...』
Korean“...”‘...’
Russian«...»„...“
Arabic«...»‘...’

Translate Conventions

VB automatically sets translate: no on elements that should never be machine-translated: <code>, <kbd>, <samp>, <pre>, and <var>.

For your own content, use the HTML translate attribute on brand names, identifiers, and technical terms:

Locale Resolution (JS)

VB provides a centralized getLocale() function that all format utilities share. The priority chain:

  1. <html lang> attribute
  2. navigator.language
  3. 'en' fallback

Individual elements can override via data-locale:

JS Utilities

Import locale utilities for custom components:

Logical Properties

VB uses CSS logical properties throughout (465+ instances). RTL layout works automatically when you set dir="rtl" on <html>. No additional CSS is needed.

Demo

i18n Typography Demo — live examples of all features on this page.

Related

Ruby Annotations

  • <ruby> — Container for ruby annotations (furigana, pinyin)
  • <rt> — Ruby text (the annotation content)
  • <rp> — Fallback parentheses for non-supporting browsers

Bidirectional Text

  • <bdi> — Bidirectional isolate (safe for user-generated content with unknown direction)
  • <bdo> — Bidirectional override (force a specific text direction)

Locale-Aware Elements

  • <q> — Inline quotations with locale-specific quote marks
  • <wbr> — Word break opportunity for CJK and long text