Internationalization

13 languages with full Unicode support, CJK/emoji rendering, and automatic locale detection — compiled directly into the C binary.

13
Languages
100%
Coverage
411
Translation Keys
20
Source Files
21
Page Files

Overview

Scorpiox Code ships with 13 languages compiled into a single static binary. No external locale files, no resource bundles, no runtime dependencies. The CLI auto-detects your system locale via LANG, LC_ALL, and LC_CTYPE environment variables. The web interface parses Accept-Language headers. Fallback is always English.

# CLI locale detection $ export LANG=ja_JP.UTF-8 $ scorpiox-code # → UI renders in Japanese # Website locale detection GET /internationalization?lang=de HTTP/1.1 # → Page renders in German # Accept-Language header Accept-Language: fr-FR,fr;q=0.9,en;q=0.8 # → Page renders in French

Supported Languages

Code Language Native Name Direction Coverage
en English English LTR → 100%
ar ArabicRTL العربية RTL ← 100%
de German Deutsch LTR → 100%
es Spanish Español LTR → 100%
fr French Français LTR → 100%
it Italian Italiano LTR → 100%
ja Japanese 日本語 LTR → 100%
ko Korean 한국어 LTR → 100%
pt Portuguese Português LTR → 100%
ru Russian Русский LTR → 100%
tr Turkish Türkçe LTR → 100%
zh-CN Chinese (Simplified) 简体中文 LTR → 100%
zh-TW Chinese (Traditional) 繁體中文 LTR → 100%

Locale Detection

CLI Detection

The CLI reads LANG, LC_ALL, and LC_CTYPE environment variables at startup via setlocale(LC_ALL, ""). On Windows, scorpiox-config.c uses setlocale(LC_ALL, ".UTF-8"). Inside containers, scorpiox-unshare.c sets LANG=C.UTF-8 as default.

Website Detection

The website uses detect_lang(environ) — first checks ?lang= query parameter, then parses the Accept-Language HTTP header. Partial matches are supported: "zh" matches "zh-CN", "de" matches "de". Fallback is English.

# detect_lang() priority order: 1. ?lang= query parameter # explicit override 2. Accept-Language header # browser preference 3. English fallback # default # Partial matching examples: "zh"zh-CN # first matching prefix "pt"pt # exact match "de-AT"de # prefix match

Website Translation System

The website uses a Python T dictionary pattern: T[key][lang]. Each page file defines translation keys for all 13 languages. The detect_lang() function checks ?lang= query parameters first, then parses Accept-Language headers. All 411 translation keys across 21 page files maintain 100% coverage for every language.

# Python T dictionary pattern — every page file T = { 'page_title': { 'en': 'Internationalization — SCORPIOX CODE', 'ja': '国際化 — SCORPIOX CODE', 'ar': 'التدويل — SCORPIOX CODE', # ... 13 languages per key }, } # Usage in HTML template <h1>{t('page_heading', lang)}</h1>

Unicode Support

Full UTF-8 encoding with wide-character support for CJK glyphs and emoji rendering. Terminal width calculations handle double-width characters correctly. The implementation spans 20 source files including sx_term.c for terminal width, sxui_input.c for wide-character input, and sx_html_strip.c for UTF-8 safe HTML parsing.

UTF-8 Encoding
All string processing uses UTF-8. No BOM required. Full 4-byte sequence support for supplementary planes.
Wide Characters
wcwidth() and wcswidth() for terminal column calculations. CJK ideographs occupy 2 columns.
Emoji Support
Emoji sequences rendered correctly in TUI. Status bar, prompts, and output all handle multi-byte sequences.
RTL Layout
Arabic interface uses dir="rtl" with mirrored CSS layouts. Flexbox direction reversal for navigation elements.

Configuration

LANG
Primary locale variable. Set to xx_XX.UTF-8 format. Example: ja_JP.UTF-8
LC_ALL
Overrides all locale categories. Takes precedence over LANG when set.
LC_CTYPE
Character classification and case conversion. Critical for wide-character support.
?lang=xx
URL query parameter override for the website. Accepts any supported language code.
# scorpiox-env.txt — force Japanese locale LANG=ja_JP.UTF-8 # Or override in shell $ export LANG=ko_KR.UTF-8 $ scorpiox-code # Windows — automatic UTF-8 # scorpiox-config.c calls setlocale(LC_ALL, ".UTF-8") # Containers — safe default # scorpiox-unshare.c sets LANG=C.UTF-8

Source Files

Unicode handling is implemented across 20 source files. Key implementation files include sx_term.c/h for terminal width calculations, sxui_input.c for wide-character input, and sx_html_strip.c for UTF-8 safe HTML parsing.