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
| Script | Languages | Token | Line Height |
|---|---|---|---|
| CJK | zh, ja, ko | --font-cjk | 1.8 |
| Arabic | ar, fa, ur, ps | --font-arabic | 1.9 |
| Hebrew | he, yi | --font-hebrew | 1.75 |
| Thai | th | --font-thai | 2.0 |
| Devanagari | hi, mr, sa, ne | --font-devanagari | 1.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>:
| Value | Behavior |
|---|---|
show | Always visible |
hide | Visually hidden, kept in DOM for accessibility |
auto | Visible for CJK languages, hidden otherwise |
| (absent) | Browser default |
Locale-Aware Quotes
The <q> element renders locale-appropriate quotation marks via CSS quotes:
| Language | Outer | Inner |
|---|---|---|
| English | “...” | ‘...’ |
| German | „...“ | ‚...‘ |
| French | «...» | ‹...› |
| Japanese / Chinese | 「...」 | 『...』 |
| Russian | «...» | „...“ |
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:
<html lang>attributenavigator.language'en'fallback
Individual elements can override via data-locale:
JS Utilities
Import locale utilities for custom components:
VbI18n String Swap
For application-level translation, VB exports a VbI18n class. It is not auto-initialized — you instantiate and configure it with your own message maps.
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.