bim

Language Detection

Vibe Site automatically detects content language and sets appropriate HTML attributes.

How It Works

The whatlang library analyzes page content to detect language.

HTML Output

Detection sets two HTML attributes:

<html lang="en" dir="ltr">

For Arabic content:

<html lang="ar" dir="rtl">

Supported Languages

Common languages detected:

LanguageCodeDirection
EnglishenLTR
ArabicarRTL
HebrewheRTL
PersianfaRTL
UrduurRTL
GermandeLTR
FrenchfrLTR
SpanishesLTR
ChinesezhLTR
JapanesejaLTR

RTL Support

Right-to-left languages automatically get dir="rtl".

The default layout includes RTL CSS:

[dir="rtl"] {
  text-align: right;
}

[dir="rtl"] nav ul {
  flex-direction: row-reverse;
}

[dir="rtl"] blockquote {
  border-left: none;
  border-right: 3px solid var(--accent);
}

Mixed Content

Language is detected per-page. A site can have English blog posts and Arabic notes.

Related: #language #rtl #internationalization @documentation