Config: list of languages to build into the runtime catalogs #150

Open
opened 2026-11-15 12:28:44 +01:00 by michael · 0 comments
Owner

Goal

The admin decides in the host config which languages are built into the
runtime catalogs. A language with only a few translated texts is not offered
until the admin adds it to the list.

Background

  • Today make resources / make dev-resources (scripts/gen-resources.lua ->
    core/resources/catalogs.lua build()) write one catalog for every language
    found in the sources. [language] only has lang and default_lang.
  • The language chain (berhtjan-core language_chain) starts with the locale of
    the user. A user with LANG=fr and five French texts sees a mix of French and
    English.
  • adapters/ui/present.lua load_language() already keeps only the languages of
    the chain that have a loaded catalog. A language that is not built is
    therefore dropped at runtime without further code.

Scope

  • New key in [language] (templates/config/fragjan.conf), e.g.
    languages = de, en: the languages that are built.
  • catalogs.lua build(): write only the listed languages. Other languages stay
    in the sources and are not written to the runtime files.
  • default_lang must be in the list. Otherwise build fails with a clear
    daw_error/v1 (no silent correction).
  • Language codes follow the existing rule (lowercase letters).
  • A listed language without any source is reported, not skipped silently.
  • Key missing: decide (open question below).

Open questions

  1. Key missing in an existing config: build all languages as today (backward
    compatible) or fail?
  2. Does the list belong to the host only? Decision so far: yes, filtering
    happens in the host at build time; berhtjan-core stays unchanged.

Acceptance criteria

  • With languages = de, en only de and en catalogs are written, also for
    dev-resources.
  • LANG=fr with fr not listed: output is English (chain falls back).
  • default_lang not in the list: build fails with daw_error/v1.
  • Listed language without source: reported.
  • Tests for build(), the config check and the template; docs/template
    comment updated.

Refs: DAW/daw-modul-berhtjan-core#13

## Goal The admin decides in the host config which languages are built into the runtime catalogs. A language with only a few translated texts is not offered until the admin adds it to the list. ## Background - Today `make resources` / `make dev-resources` (scripts/gen-resources.lua -> core/resources/catalogs.lua build()) write one catalog for every language found in the sources. [language] only has `lang` and `default_lang`. - The language chain (berhtjan-core language_chain) starts with the locale of the user. A user with LANG=fr and five French texts sees a mix of French and English. - adapters/ui/present.lua load_language() already keeps only the languages of the chain that have a loaded catalog. A language that is not built is therefore dropped at runtime without further code. ## Scope - New key in [language] (templates/config/fragjan.conf), e.g. `languages = de, en`: the languages that are built. - catalogs.lua build(): write only the listed languages. Other languages stay in the sources and are not written to the runtime files. - `default_lang` must be in the list. Otherwise build fails with a clear daw_error/v1 (no silent correction). - Language codes follow the existing rule (lowercase letters). - A listed language without any source is reported, not skipped silently. - Key missing: decide (open question below). ## Open questions 1. Key missing in an existing config: build all languages as today (backward compatible) or fail? 2. Does the list belong to the host only? Decision so far: yes, filtering happens in the host at build time; berhtjan-core stays unchanged. ## Acceptance criteria - [ ] With `languages = de, en` only de and en catalogs are written, also for dev-resources. - [ ] LANG=fr with fr not listed: output is English (chain falls back). - [ ] default_lang not in the list: build fails with daw_error/v1. - [ ] Listed language without source: reported. - [ ] Tests for build(), the config check and the template; docs/template comment updated. Refs: DAW/daw-modul-berhtjan-core#13
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/fragjan#150
No description provided.