pkg:clod/com.clodhub/translations 0.13.0 Chooses each person's language and looks up the application's text in English, French, German or Spanish. Lets an application speak English, French, German and Spanish, and pick the right one for each person. It does two jobs. At run time it chooses a language: a person whose device says `fr-CA` gets Canadian French if the application has it, otherwise French, otherwise the application's default language; and it looks up each piece of text in that language, showing the text's key when a translation is missing so the gap is visible rather than blank. At build time a generator takes one table of all the application's text, checks it, and writes the files each platform reads: `strings.json` for the web, `Localizable.xcstrings` for Apple and `strings.xml` for Android. It refuses a table where a translation is missing or where the translations do not use the same placeholders (such as `{name}`), so a French message can never drop the player's name that the English one shows. The application writes the text; this component only chooses, checks and delivers it. Examples A Montreal player's phone is set to `fr-CA`; the application offers `en fr`, so the game appears in French. A Berlin player is set to `de-DE`; German is not offered, so the game appears in English. A developer adds a new message in English and French only; the generator stops with an error naming the missing German and Spanish text instead of shipping a gap. A French translator moves `{name}` to the end of a sentence; it still shows the right player's name. Package URL: pkg:clod/com.clodhub/translations@0.13.0 Class: Translations (pkg:clod/com.clodhub/translations-class@1.1.0): The application's text in several languages with fallback. Any component of this class can fill a recipe slot that asks for it. Category presentation/localisation; https://clodhub.com/classes/translations-class.txt; 0 other components of this class: https://clodhub.com/components.txt?class=pkg%3Aclod%2Fcom.clodhub%2Ftranslations-class Provides (1) - language (com.clodhub/language 1.0.0): Language selection and message lookup for every platform, and a generator of platform string resources for English, French, German and Spanish. Web: implementation/web/i18n.ts. Apple: implementation/apple/Sources/Language.swift. Android: package com.clodhub.i18n. Generator: implementation/scripts/generate.py. components that use it: https://clodhub.com/components.txt?requires=com.clodhub%2Flanguage Requires (0) - none Settings (1) The installer collects one setting: - `languages`: the languages the application offers, separated by spaces (optional; default `en fr de es`). Allowed names are `en` (English), `fr` (French), `de` (German) and `es` (Spanish), each at most once, and `en` must be among them, because English is the language every text is written in first. For example `en fr` offers English and French only. The installed web client reads the setting from `web/languages.ts`, and the generator takes it as `--languages`. The application supplies its own text table and remembers each person's choice. - languages: string (label); optional, default "en fr de es" Depends on components: none How to use in a recipe A recipe uses it through a slot of class Translations (pkg:clod/com.clodhub/translations-class 1.1.0), naming pkg:clod/com.clodhub/translations as the slot's preferred component or substituting it for another component of the class. The recipe connects what it provides (language) to the slots that use it. The recipe sets languages; any it leaves out takes its default. - as a slot in recipe.json components: {"id":"translations","class":{"name":"pkg:clod/com.clodhub/translations-class","version":"1.1.0","digest":"513ec237401f805e4b7e93e56be2f8051743f7ce5f4963c81e49782771b09bbc"},"preferred":{"name":"pkg:clod/com.clodhub/translations","version":"0.13.0"}} - in place of another component of the class: clod fetch translations@0.13.0 --store store --from https://clodhub.com, then clod design RECIPE@VERSION --store store --answers answers.json --substitute SLOT=translations@0.13.0 --out definition.json Used by recipes: pkg:clod/com.clodhub/ourpoker-recipe 0.13.0 (slot translations) For developers: how an application uses it Write all the application's text in one table, `resources/strings.json`, where each key maps to its text in each offered language: ```json { "welcome": { "en": "Hello {name}", "fr": "Bonjour {name}", "de": "Hallo {name}", "es": "Hola {name}" } } ``` Keys start with a letter and hold letters, digits and underscores. Then generate the platform files: ``` python3 components/translations/scripts/generate.py --strings resources/strings.json --web web/src --apple ios/Resources --android android/app/src/main/res --languages "en fr de es" ``` On the web, `selectLanguage(navigator.language, parseLanguages(languages), "en")` picks the language and `lookup(messages, "welcome")` returns the text. On Apple use `Language.swift`; on Android import the `com.clodhub.i18n` functions (`AppLanguage`). Native placeholders are numbered in the order they first appear in English; web placeholders keep their names. Accounts and services None. No account, service or network access; the generator writes only the folders it is given. How it is checked `node --test tests/web.test.ts` (required) checks language choice (exact, then the base language, then the fallback), lookup including empty text and missing keys, the `languages` setting, and that the interface document matches the code. `python3 -m unittest discover -s tests -p test_*.py` (required) runs the real generator: all four languages, escaping for each platform, and refusal of a missing translation, a duplicate key or mismatched placeholders before anything is written. `python3 tests/native.py apple` and `python3 tests/native.py android` compile the Swift and Kotlin forms and check them on the same cases. Updates Updates replace the component's files; it stores nothing. Removing it means removing its imports and the generated text files; each person's remembered language stays in the application's own storage. Tags: localisation, presentation, translations Targets: client android, ios, macos, tvos, web, windows; server none Publisher: George McIntyre (george-mcintyre) Guardians: Level N Ltd (guardian key 08775f20) Source: clodhub/translations release v0.13.0; digest sha256:40b0607e774993f20d2fbcedce57db57a231f3f27b60e14518dc8f71276e4c3e Release: features Line 0.13: no security releases Quality: Integration-tested, certified Known vulnerabilities: none known (checked 2026-11-26 at OSV); https://clodhub.com/api/components/translations/0.13.0/vulnerabilities Downloads: 1 in 30 days; 1 of this version Classes: https://clodhub.com/classes.txt; this component as JSON: https://clodhub.com/api/components/translations/0.13.0 Bundle download: GET https://clodhub.com/api/components/translations/0.13.0/bundle returns a link valid for one hour Implements: pkg:clod/com.clodhub/translations-class@1.1.0 513ec237401f805e4b7e93e56be2f8051743f7ce5f4963c81e49782771b09bbc com.clodhub/language 1.0.0 entry modules: android android/src/main/java, ios apple/Sources, macos apple/Sources, tvos apple/Sources, web web/index.ts, windows web/index.ts shared behaviour suites: shared Platforms: android, ios, macos, tvos, web, windows Toolchains: android >=8.0.0, ios >=17.0.0, java >=17.0.0 <27.0.0, kotlin =2.4.21, macos >=14.0.0, node >=26.5.0 <27.0.0, swift =6.4.2, tvos >=17.0.0 Frameworks: none Styles: scope none; 0 namespaces; 0 conflicts Licence: Apache-2.0; 0 upstream sources, 0 exact dependencies, 30 files (listed on the details page) Suitable for jobs: translations profile any: cost none; load none; regions any; compliance none Notes: Pure library and local generator; no hosted service, account or measured load. Data migration: this component keeps no data Maintainers: Level N Ltd; https://github.com/clodhub/translations/issues; updates https://github.com/clodhub/translations/releases (manual) What you download translations-0.13.0.tar, from release v0.13.0 of clodhub/translations: 30 files - Documents and manifests (8): CONTRACT.md, INSTRUCTIONS.md, LICENCE, NOTICE, PROVENANCE.md, SOURCE.md, ... - Source code (6): android/ (1), apple/ (1), scripts/ (1), web/ (3) - Tests (6): android/ (1), apple/ (1), fixtures/ (1), native.py, test_generate.py, web.test.ts - Interface documents (1): language.json - Class files: the class's interfaces and shared checks (3): translations-class/ (3) - Examples (1): consumer.ts - Diagrams (5): definition.json, examples/ (1), output/ (3) Installing copies 6 of them into the application under components/translations/: android 1, apple 1, scripts 1, web 3 Not included: the values of its settings, which the recipe writes; any secret The archive is a release file on the publisher's public GitHub repository; ClodHub keeps this page and a pointer to the release, not the code. clod checks the archive's sha256 fingerprint before anything is copied, and installing runs none of the package's code. Versions - 0.13.0 features (2026-11-26T11:34:45.655Z) sha256:40b0607e774993f20d2fbcedce57db57a231f3f27b60e14518dc8f71276e4c3e Links Details (package foundations, upstream sources, exact dependencies, styles, class inventories, files): https://clodhub.com/components/translations/details.txt?version=0.13.0 Page: https://clodhub.com/components/translations; JSON: https://clodhub.com/api/components/translations/0.13.0; connections diagram: https://clodhub.com/api/components/translations/0.13.0/connections.svg Copyright Level N Ltd 2026