Lexicon.Language resource #13

Open
opened 2026-09-26 13:58:31 +00:00 by belvedere · 0 comments
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.
Sign in to join this conversation.
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#13
No description provided.