linexcel.i18n¶
linexcel.i18n ¶
Supported languages for the viewer UI and the AI documentation.
The set is deliberately closed. language selects a stored system prompt
and is interpolated into the generated viewer, so it is validated against this
allowlist rather than escaped or passed through: an arbitrary string would let a
caller steer the model's instructions or reach the generated JavaScript.
Adding a language means adding an entry here and in :mod:linexcel.aidoc's
two prompt registries. tests/test_lineage.py asserts the three stay in sync,
so a partial addition fails the suite instead of surfacing as raw keys in the
report or a KeyError at generation time.
Provenance: en and fr were written by hand. The other seven languages,
here and in the prompt registries, were produced with AI assistance and have not
been reviewed by native speakers — corrections welcome.
validate_language ¶
Return language if it is supported, else raise ValueError.
validate_language("ja") 'ja' validate_language("klingon") Traceback (most recent call last): ... ValueError: Unsupported language: 'klingon'. Use one of ('en', 'fr', 'es', 'de', 'it', 'pt', 'nl', 'ja', 'zh')
Source code in src/linexcel/i18n.py
ui_payload ¶
Interface strings to embed for language.
Only the requested language and the English fallback are shipped: the
viewer resolves a missing key through I18N.en, so embedding the other
seven locales in every report would be dead weight.