Lexicon.Language resource #65

Closed
opened 2026-09-26 13:58:57 +00:00 by belvedere · 1 comment
Collaborator

Objective: Languages are data, not an enum — this is what makes multiple source/target
languages possible.

Files:

  • Create: lib/first_thousand_words/lexicon/language.ex
  • Modify: priv/repo/seeds.exs

Steps:

  1. Attributes: code (ISO 639-1, e.g. en, es; identity, allow_nil? false),
    name, native_name, direction (:ltr / :rtl), enabled? (default false),
    word_count_target (default 1000).
  2. Seed a handful of languages with enabled? false except the first supported pair.
  3. Add a read :enabled code interface used by the rest of the app.

Verify: mix ecto.reset then FirstThousandWords.Lexicon.read_enabled_languages!() in IEx.

Note: keep direction in the schema from day one — retrofitting RTL into a built typography
layer is expensive.

**Objective:** Languages are data, not an enum — this is what makes multiple source/target languages possible. **Files:** - Create: `lib/first_thousand_words/lexicon/language.ex` - Modify: `priv/repo/seeds.exs` **Steps:** 1. Attributes: `code` (ISO 639-1, e.g. `en`, `es`; identity, `allow_nil? false`), `name`, `native_name`, `direction` (`:ltr` / `:rtl`), `enabled?` (default false), `word_count_target` (default 1000). 2. Seed a handful of languages with `enabled? false` except the first supported pair. 3. Add a `read :enabled` code interface used by the rest of the app. **Verify:** `mix ecto.reset` then `FirstThousandWords.Lexicon.read_enabled_languages!()` in IEx. **Note:** keep `direction` in the schema from day one — retrofitting RTL into a built typography layer is expensive.
Author
Collaborator

Duplicate of #13 — created by a re-run whose pagination helper only saw the first page of issues. Closing to keep the backlog clean. Repo owner can delete this outright.

Duplicate of #13 — created by a re-run whose pagination helper only saw the first page of issues. Closing to keep the backlog clean. Repo owner can delete this outright.
Sign in to join this conversation.
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
nickkeers/first-thousand-words#65
No description provided.