Version 8.8.0

All pages

Languages

Solid Memo speaks English (en), Swedish (sv), Korean (ko), German (de), Spanish (es) and French (fr). Every text the app shows comes from a message file. Text that comes with the data — deck titles and descriptions, card text — is shown in the language the user says it's in (Text in the user's languages).

Which language

pickLocale (locale.ts) decides, in order:

  1. the language the user chose with the language list (a globe and the language's name in itself) atop every screen, or under Language in the study preferences. The device store keeps it on this device (deviceChoices.ts, key solid-memo:language), not in the pod, which the sign-in screens come before;
  2. else the first of the browser's preferred languages (navigator.languages) the app speaks — sv-SE counts as sv;
  3. else English.

AppShell, Solid Memo's and the Studio's shell, sets <html lang> to it. Deck and card text is shown in the same language, else the browser's, else English, else the first language it has (shown in langText.ts). Text in another language than the page's is marked with its own lang (readerLang, ReaderText); untagged text and text in no language (zxx) get none.

A deck may have its own card language, chosen by the learner and kept on the deck in the pod (sm:deckCardLanguage, data-model.md). Its card text (fronts, backs, notes, labels, picture descriptions and wrong options) ranks that language first: shown(text, [deckLang, locale, ...navigator.languages]). On a course's own screens (a course is a deck), it covers all the course's text: the course's and each chapter's title and description, and each step's theory, its chunks counted in the language shown. Elsewhere only card text follows it; a deck's keywords, the app's own text and <html lang> never do. Course text in another language is marked with its own lang, as card text is.

A screen of one deck's cards sits under a CardLanguage with the deck's language: study, the Browser, a card's page, and every screen of a deck in the Studio. A cram of the leeches takes the language of the deck of the card up. The components that show card text (CardFace, DataText, DataLine, CardText) take their reader from useCardText. A screen naming cards of several decks, such as the leeches or the Studio's command palette, takes each deck's reader from cardReader(deck.cardLanguage) (cardLanguage.tsx).

A course's page, chapter and final review sit under a CourseLanguage, a CardLanguage for its questions' cards too. The components that show a course's own text (CourseText, DataProse, useProseChunks) take their reader from useCourseText. On those routes the trail's course and chapter, and so the page's title, are named in it. Elsewhere, as in the Studio's trial of a course and the courses above the deck list and their statistics, readerText shows card and course text as any text.

The learner chooses it on the deck's Preferences page (DeckCardLanguageForm, #/deck-preferences): first "The app's language", the default, which clears the choice, then the languages the deck's cards state on their fronts and backs (preferableCardLanguages: no untagged text, no zxx). It lists at most LANGUAGE_CHOICE_LIMIT (100) of them, the most used. A choice the cards no longer state stays listed, to be cleared.

For a course's deck (Deck.course, or a release that's a course for an older copy) the picker is "Course language", with words of its own. It lists every language the course states (preferableCourseLanguages): its deck's cards, and its release's cards, title, description, chapter titles and descriptions and step theory (the deck starts with no cards and gains one only as its question is first answered). The outline is read as the courses above the deck list read it (queries.courseStrip); until then the list holds only the default and the choice. The course's page links to its preferences (CourseLinks.preferencesHref; the Studio's trial gives none). Its screens read the choice from the deck list, which saving refreshes.

A deck's keywords, several per language, are shown only in the chosen language. keywordsIn (keywords.ts) shows those under a tag with its primary subtag (sv, sv-se, sv-fi for Swedish) and those in no stated language (untagged and zxx), each once. There's no fallback: without those, none show. Library decks carry their title, description and keywords in every language the app speaks, so every reader sees keywords on them. npm run library:check holds each deck's newest version to it: a language added to LOCALES fails every deck until a new version adds it (deck-library.md). The library's search covers titles, descriptions and keywords in every language.

Text in the user's languages

Text the user writes — a deck's name, description and keywords, a card's sides, notes, labels and picture descriptions — is saved language-tagged, one value per language (keywords: a comma-separated list per language). Its language is the one the user states (deck format 6, card format 7: shapes.md), never the page's: an English speaker on a Swedish page types English.

Older data may not say its language (card sides before card format 5, keywords before deck format 6); the app doesn't guess it. Untagged keywords are kept, or removed, as they are; a keyword added or changed needs its language. While any is left, the deck's page says so (DeckLanguagesNotice), linking to the Languages section of its preferences (DeckLanguagesSection), where untagged fronts or backs get one language at once (stateCardLanguages). The Browser marks the cards with a side in no stated language and can list only those (languages=unstated in its URL). Text still as its library release has it is left alone, for a later release to update.

The same words under several languages are text in each, accepted as they are: "Stockholm"@en with "Stockholm"@sv, like "1969"@sv with "1969"@it. That includes the identical English copies the app wrote while the formats required English, which it can't tell from a real translation and neither flags nor offers for removal. In the editor each language is an entry, edited, retagged or removed like any other translation.

The deck's page weighs its text on its own (deckLanguageIssues over deckLanguages, pure domain functions) from the cards it has read and the deck's library release (UseCases.deckRelease), not a use case of its own, which would read the cards again. When the release can't be read, the library's text can't be told from the user's. If the deck's text holds none to settle even counting the library's, nothing is said; otherwise the notice says the check couldn't be made, not counts, and still links to the Languages section, which shows why.

Formatted text

In Markdown (markdown.md) each language's value is its own Markdown document under its own tag, and every rule above holds of it: shownTag, textNeedsLanguage, one text per language, a distractor in the back's languages. A code block inside @en text keeps @en, and a code-only back may be zxx. The card editor hints under each language's text; its preview shows the main one, the one being written.

The app's own words about Markdown are messages: cardContentFields.markdown* and .preview* the editor's, and markdownHelp.* its cheat sheet's (the syntax is code, the same in every language). markdownProblem.* has one for each problem markdownProblems names, and markdown.* the names of a code block, a table region and a link's host.

Messages

packages/ui/src/i18n/en.json and the other languages' files beside it (sv.json, ko.json, de.json, es.json, fr.json) hold one namespace per component (deckList, instancePicker, …) and a few shared ones (common, language, footer). studio holds what the page says of the Studio before its code is here: its name, tagline, the links to it and back, and that it's opening; its screens have their own files (The Studio's messages). Components read them through useI18n() (i18n.tsx):

const { t, tx, readerText, formatDate, directionLabel } = useI18n();
t("deckList.heading");                          // "Decks"
t("common.cardCount", { count: 3 });            // "3 cards" — a plural message
tx("app.loggedInAs", { name: <ExternalLink … /> }); // markup inside a sentence

A release's highlights for users are messages under whatsNew.highlight, one per id (releasing.md).

Tests in i18n.test.tsx hold every other message file to exactly the keys and placeholders of en.json, and every key the source asks for to one en.json has. Components outside a provider speak English: component tests query English text without setup.

Loading a language

The page fetches only its own language's messages. en.json is imported statically: the fallback, the crash screen's language when nothing else has loaded, and the source of MessageKey. Every other language's file is fetched with import() (UI_CATALOGS in i18n.tsx), a chunk of its own, which build.test.ts checks (testing.md).

The Studio's messages

The Studio's screens say the rest of studio.*, from a file per language in apps/studio/src/i18n/, which come with the Studio's chunk: a learner who never opens the Studio downloads none (studio.md).

Translations

English is the source; Swedish is the maintainer's own. Korean, German, Spanish and French were translated with AI: one model drafted each, following a glossary per language (register, typography, the words for deck, card, review…), then an independent check translated each message back into English and fixed what drifted. No native speaker has reviewed them yet; corrections from one are welcome. German says du, Spanish tú (neutral, international), French vous, Korean the polite 해요 style.

The About page, a static page for search engines and people deciding whether to use Solid Memo, is outside the app and its catalogs, in English only for now. Pages per language, linked to each other with hreflang, can come later.

These docs, which the site serves at /docs/ too (deployment.md), change with the code and are in English only, as their pages say (lang="en"). The app's footer links to them with hreflang="en", and its label says "in English" in every other language (footer.docs), as the footer's link to the About page, /about/, does (footer.about).

Adding a language

  1. Add its code to LOCALES in packages/core/domain/src/locale.ts, and to the languages the page names in its JSON-LD: inLanguage and the store listing's language in apps/web/index.html, and the list build.test.ts expects ("the page's structured data").
  2. Add packages/ui/src/i18n/<code>.json with every key of en.json, and register it in UI_CATALOGS in i18n.tsx as an import() (Loading a language). Add it to the chunks the build test expects (build.test.ts, "the messages"). Do the same for the Studio: apps/studio/src/i18n/<code>.json, with every key of the Studio's en.json, in STUDIO_CATALOGS in catalogs.ts.
  3. Name it in itself in LANGUAGE_NAMES in LanguageSelector.tsx.
  4. Give each plural message exactly the forms its plural rules name (new Intl.PluralRules("<code>").resolvedOptions().pluralCategories): only other in Korean, Japanese and Chinese; one, many and other in Spanish and French; one, few, many and other in Polish and Ukrainian.
  5. Register both files in the journeys' harness: Locale and CATALOGS in e2e/journeys/harness/strings.ts, and the language's name in switchLanguage in e2e/journeys/pages/Chrome.ts.
  6. Extend the tests naming every language: locale.test.ts, i18n.test.tsx (its catalogs, a plural, a date, a language's name), the Studio's catalogs.test.ts, LanguageSelector.test.tsx, PreferencesScreen.test.tsx.
  7. Name and define every topic in it in ns/vocab/topics.ttl (vocab.md): the scheme's dcterms:title and skos:definition, and each concept's skos:prefLabel and skos:definition, with owl:versionInfo bumped and a skos:changeNote saying so. Then run npm run format:turtle, npm run generate and npm run crosscheck, and update the tests that compare topic labels (concepts.test.ts, library.test.ts).
  8. If its script needs its own fonts, line breaking or heading treatment, add :lang(<code>) rules to packages/ui/src/style.css, with tests in style.test.ts, as Korean has (theme.md). The Studio's headings are in the body's type and weight whatever the language (apps/studio/src/ui/studio.css); check them there too.
  9. A language written right to left, as the app's own, needs the page mirrored (dir="rtl" on <html>) and every layout rule that names a side made logical; the style sheet already sets its text's direction.

The shapes' sh:messages stay in English and Swedish; a new language needs none. Its readers see a shape's own message in English, marked so, and the validator's messages in their language (shapes.md).