Skip to content

feat(decks): give 17 label decks Korean, German, Spanish and French card text from Wikidata - #294

Merged
ixuz merged 19 commits into
mainfrom
wikidata-labels
Oct 24, 2026
Merged

ixuz merged 19 commits into
mainfrom
wikidata-labels

Conversation

@ixuz

@ixuz ixuz commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

What and why

Goal 7 ("In your language") stopped at the deck list for most of the library: the app and every deck's title and description come in six languages, but the cards of label decks such as the capitals, currencies or elements were in English and Swedish only. Wikidata already names these things in every language the app speaks, under CC0 like the decks.

The script. scripts/wikidata_labels.py makes a deck's next version with its cards in Korean, German, Spanish and French as well, from the labels of the Wikidata items each card names. It is built like scripts/taxonomy_deck.py: standard library only, with tests (scripts/test_wikidata_labels.py) and a new section, Languages from Wikidata.

  • Mapping. A checked-in mapping per deck, scripts/wikidata-labels/<deck>.json, says which items each card is about, so nothing is guessed again on a later run. Text built from several parts ("Afghan afghani (AFN)", "Highest point of Albania", "Pretoria, Cape Town, and Bloemfontein") is a template or a frame written in each language. The mapping also translates the card labels ("Capital") and gives the next description.
  • What a card gets. English and Swedish text and the notes stay exactly as they are. A card gets a language only when every item it names has a label in it. A card may also refuse a label that is wrong for it, such as a former scientific name, an outdated or self-proclaimed name, or a catalog number like "(1) Ceres"; it then goes without that language until the label is mended on Wikidata. The report lists both cases.
  • Subjects. Every card names its items as dcterms:subject.
  • Reproducible. A version records the commit that last changed the script, the script's checksum, the mapping's checksum, the command line and the revision of every item read. --verify makes the cards again from those revisions, byte for byte.
  • Polite to Wikidata. Requests are serial, batched 50 items at a time, gzipped and cached by revision, with an honest User-Agent, following Wikimedia's User-Agent policy and API etiquette. They send no maxlag: on Wikidata it counts the query service's lag, which edits cause, and it refused every read for over an hour while this was written.
  • Not a CI gate. The new Wikidata workflow runs --verify weekly and by hand. When Wikidata cannot be reached, it warns and passes.

The decks. Each gets one new version, in a commit of its own: capitals-of-the-world v4, then world-currencies, periodic-table, solar-system, constellations, eu-member-states, us-states-and-capitals, federal-states-and-capitals, highest-points-of-europe, world-rivers, famous-buildings, nordic-world-heritage-sites, nordic-birds, nordic-fish, nordic-mammals, nordic-trees and brightest-stars v3.

  • Choosing items. Where possible, items were taken through the relation between a card's two sides rather than by name: a country's capital (P36), currency (P38) or highest point (P610), a river's mouth (P403), a building's architect (P84), a species by its taxon name.
  • Review. Every mapping was then checked card by card, for the item and for each language's text. Each commit body gives the deck's counts per language.
  • Coverage. The geography, astronomy and element decks have all four languages on nearly every card. The species decks have the fewest, since Wikidata often gives a taxon only its scientific name.

Other changes.

  • packages/solid/src/libraryImport.test.ts pinned capitals v3 as the newest release; it now names v4.
  • The library-upgrade journey updates brightest-stars release 1 to the newest, now release 3. The offer changes every card as well as the name, description and keywords, and lists both releases' notes. The Studio's panel lists the changed cards too, so its page object reads the notes from the panel's first list.
  • A pod test that broke on Node 24. e2e/pod/src/releases.integration.test.ts checked that a deleted instance keeps its published release with a GET, and read only the status. Drafting brightest-stars v1's next version copies the descriptions of the series' other versions, so v3 grew that release from 63,675 bytes to 69,657 bytes, past 64 KiB. The unread body filled the fetch's buffer and paused its parser, and the server then closed the connection, as the harness asks of every request. Node 24's undici then failed an internal assertion outside any test (nodejs/undici#5360, fixed in undici 8). Every test passed, but the Community Solid Server pod jobs failed on the unhandled error. The test now asks with HEAD, as it does a few lines above (commit test(pod): ask for a published release's head, not a body left unread).

For the reviewer.

  • Rebasing. Each deck version records the script's commit. If this branch is rebased, the versions must be made again from the rebased commit (the commands are in the docs). A merge commit keeps them.
  • Labels to mend on Wikidata. Some labels are wrong upstream and are refused or left for now: inconsistent capitalization in French, Spanish and German (for example "Ours brun", "Albanischer Lek"), "Rjukkan", "Satyros de Priène". Cards regain a refused language once the label is fixed and the deck's next version is made.
  • Card languages in the library. A deck's dcterms:language now lists a language once any of its cards has it, which feat(library): name and filter by the languages of a deck's cards #286's card-language filter shows. For example, Nordic trees lists Korean, though 24 of its 46 cards have it.

Closes: #284

Checklist

  • One issue. This pull request addresses one issue, linked above.
  • One step. This pull request does not finish its issue, so it says Refs:, not Closes:. Leave this unchecked otherwise.
  • Done, as AGENTS.md defines it: npm run check passes (lint, Markdown and spelling included), npm run lint:reuse too if a file was added, and npm run crosscheck too if ns/ or decks/ changed. (npm run check passes on every commit; lint:reuse, crosscheck (276 of 276 documents conform), lint:workflows and lint:commits pass too. The pod suites against CSS 6, CSS 7 and CSS ACP pass under Node 24 with no unhandled error.)
  • Tests. New and changed code has its tests, and every package stays at 100% coverage (docs/testing.md). (The script has 48 unittest tests, run by npm run test:crosscheck; no package code changed.)
  • Docs. The docs say what changed, and a new page in docs/ is listed in docs/docs.ttl. (A new section in deck-library.md and notes in testing.md; no new page.)
  • Languages. A new or changed message is in every locale: en, sv, ko, de, es and fr (packages/ui/src/i18n/). (n/a: no message changed.)
  • Vocabulary and shapes. Any change to ns/ was agreed in an issue first; no published ns/shapes/*/vN.ttl or decks/*/vN.ttl was edited; generated files were regenerated, not edited. (ns/ is unchanged; each deck gets a new version, and decks/index.ttl was written by npm run library.)
  • Breaking? Nothing in the public API breaks, or a commit says so (! and a BREAKING CHANGE: footer). npm run check:breaking sees a line of api/ that goes, but not a feature removed, nor a reader that reads less than before. (Only new deck versions and a script; no API changes.)
  • Pod data. Any change to what the app writes to a pod comes with its migration (docs/migrations.md). (n/a: the app writes nothing new; a copy's upgrade to the new versions goes through the existing library upgrade.)
  • Policy. Any change to an external rule the code follows (SM-2, the plural rules, a specification) is cited. (Wikimedia's User-Agent policy and API etiquette are cited in the script and the docs, with why no maxlag is sent.)
  • Licenses. New content is MIT, or a deck states its own license; a new file has its SPDX header (npm run lint:reuse), or a new deck its line in REUSE.toml; third-party content is credited. (Wikidata's labels are CC0, as the decks are, and each version names Wikidata as a source; the mappings are JSON, covered by REUSE.toml.)
  • Architecture. Imports follow docs/boundaries.md and the layers of docs/architecture.md. (n/a: the script is a standalone Python tool; no package imports changed.)
  • Run. I ran the app (npm run dev) and tried the change, and considered the user journeys.
  • Authorship. I read and understand every line of this pull request, and answer for it, whatever tools helped write it (CONTRIBUTING.md).
  • Commits. Each commit is one logical change, in Conventional Commits form (type(scope): subject, ! and a BREAKING CHANGE: footer if it breaks something), with an imperative subject and a body that explains why (CONTRIBUTING.md).

@ixuz ixuz added enhancement New feature or request deck A wrong card, a missing card, or a new deck i18n labels Oct 24, 2026
@ixuz
ixuz enabled auto-merge October 24, 2026 19:19
ixuz added 19 commits October 24, 2026 22:24
Most library cards are in English and Swedish only, though many are
labels of well-known things that Wikidata names in every language the
app speaks, under CC0 like the decks. scripts/wikidata_labels.py makes
a deck's next version with its cards in Korean, German, Spanish and
French as well, from those labels, keeping the English and Swedish text
as it is.

A checked-in mapping per deck (scripts/wikidata-labels/<deck>.json)
says which items each card is about, once, so nothing is guessed again;
text built from several parts is a frame written in each language. A
card may refuse a label that is wrong for it, such as a species'
former scientific name, until it is mended on Wikidata. Each
card names its items as dcterms:subject. A version records the script's
commit and checksum, the mapping's checksum, the command line and the
revision of every item read, and --verify makes its cards again from
those revisions, byte for byte.

The requests are serial, batched, cached and sent with an honest
User-Agent. They send no maxlag, which on Wikidata counts the query
service's lag and refused every read for over an hour while this was
written. A weekly workflow runs --verify; it never gates a pull request,
and passes with a warning when Wikidata cannot be reached.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but every country and capital in English or Swedish.
Version 4 of capitals-of-the-world adds those four languages to the
cards from Wikidata's labels, made by scripts/wikidata_labels.py from a
mapping of each card to its country and capital, with the capital taken
from the country's own capital statement (P36). A three-capital answer
is a frame written in each language.

237 of the 243 cards have Korean, 239 German, 236 Spanish and 240
French. The rest lack a label, or refuse one that is wrong for the card
(a former or self-proclaimed name, a literal translation of a proper
name, a district for its city), until Wikidata mends it. English and
Swedish text is unchanged, and every card names its items as
dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of world-currencies in English or Swedish.
Version 3 adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers each country and its currency, the currency taken
from the country's own currency statement (P38) by the ISO code on the
card.

Of the 193 cards, 191 have Korean, 190 German, 183 Spanish and 192
French. The rest lack a label in that language, or refuse one that is
wrong for the card, until Wikidata mends it. English and Swedish text is
unchanged, and every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of periodic-table in English or Swedish.
Version 3 adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers each element's name on the back; the symbol on the
front stays as it is.

Of the 118 cards, 118 have Korean, 118 German, 118 Spanish and 118
French. Every card has all four. English and Swedish text is unchanged,
and every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of solar-system in English or Swedish.
Version 3 adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers the planets, moons, dwarf planets and belts the cards
name, with the questions around them written once as frames in each
language; the eight "Nth planet from the Sun" fronts and the other
descriptive fronts stay as they are.

Of the 52 cards, 51 have Korean, 44 German, 52 Spanish and 48 French.
The rest lack a label in that language, or refuse one that is wrong for
the card, until Wikidata mends it. English and Swedish text is
unchanged, and every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of constellations in English or Swedish.
Version 3 adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers each constellation's name on the back; the Latin name
on the front stays as it is.

Of the 88 cards, 88 have Korean, 85 German, 84 Spanish and 88 French.
The rest lack a label in that language, or refuse one that is wrong for
the card, until Wikidata mends it. English and Swedish text is
unchanged, and every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of eu-member-states in English or Swedish.
Version 3 adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers each country, inside its question written once as a
frame in each language; the year on the back stays as it is.

Of the 48 cards, 48 have Korean, 48 German, 48 Spanish and 48 French.
Every card has all four. English and Swedish text is unchanged, and
every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of us-states-and-capitals in English or
Swedish. Version 4 adds those four languages from Wikidata's labels,
made by scripts/wikidata_labels.py from a mapping of the cards to the
items they name, which covers each state and its capital, the capital
taken from the state's own capital statement (P36).

Of the 50 cards, 50 have Korean, 50 German, 50 Spanish and 50 French.
Every card has all four. English and Swedish text is unchanged, and
every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of federal-states-and-capitals in English
or Swedish. Version 4 adds those four languages from Wikidata's labels,
made by scripts/wikidata_labels.py from a mapping of the cards to the
items they name, which covers each state and its capital, the capital
taken from the state's own capital statement (P36).

Of the 46 cards, 46 have Korean, 44 German, 45 Spanish and 46 French.
The rest lack a label in that language, or refuse one that is wrong for
the card, until Wikidata mends it. English and Swedish text is
unchanged, and every card names its items as dcterms:subject.

Refs: #284
… languages

Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of highest-points-of-europe in English or
Swedish. Version 3 adds those four languages from Wikidata's labels,
made by scripts/wikidata_labels.py from a mapping of the cards to the
items they name, which covers each country, inside its question written
once as a frame in each language, and its highest point, from the
country's own statement (P610).

Of the 40 cards, 25 have Korean, 39 German, 38 Spanish and 40 French.
The rest lack a label in that language, or refuse one that is wrong for
the card, until Wikidata mends it. English and Swedish text is
unchanged, and every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of world-rivers in English or Swedish.
Version 3 adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers each river and the water it flows into, from the
river's own mouth statement (P403).

Of the 50 cards, 45 have Korean, 50 German, 49 Spanish and 49 French.
The rest lack a label in that language, or refuse one that is wrong for
the card, until Wikidata mends it. English and Swedish text is
unchanged, and every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of famous-buildings in English or Swedish.
Version 3 adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers each building and its architects, from the building's
own architect statement (P84).

Of the 50 cards, 29 have Korean, 46 German, 47 Spanish and 46 French.
The rest lack a label in that language, or refuse one that is wrong for
the card, until Wikidata mends it. English and Swedish text is
unchanged, and every card names its items as dcterms:subject.

Refs: #284
…nguages

Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of nordic-world-heritage-sites in English
or Swedish. Version 3 adds those four languages from Wikidata's labels,
made by scripts/wikidata_labels.py from a mapping of the cards to the
items they name, which covers each site and its country or countries.

Of the 44 cards, 23 have Korean, 39 German, 34 Spanish and 39 French.
The rest lack a label in that language, or refuse one that is wrong for
the card, until Wikidata mends it. English and Swedish text is
unchanged, and every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of nordic-birds in English or Swedish.
Version 3 adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers each species' common name on the front; the
scientific name on the back stays as it is, and a label that is a
scientific name, now or formerly, is not taken for a translation.

Of the 86 cards, 74 have Korean, 66 German, 28 Spanish and 85 French.
The rest lack a label in that language, or refuse one that is wrong for
the card, until Wikidata mends it. English and Swedish text is
unchanged, and every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of nordic-fish in English or Swedish.
Version 3 adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers each species' common name on the front; the
scientific name on the back stays as it is, and a label that is a
scientific name, now or formerly, is not taken for a translation.

Of the 55 cards, 18 have Korean, 55 German, 10 Spanish and 38 French.
The rest lack a label in that language, or refuse one that is wrong for
the card, until Wikidata mends it. English and Swedish text is
unchanged, and every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of nordic-mammals in English or Swedish.
Version 3 adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers each species' common name on the front; the
scientific name on the back stays as it is, and a label that is a
scientific name, now or formerly, is not taken for a translation.

Of the 63 cards, 63 have Korean, 61 German, 11 Spanish and 29 French.
The rest lack a label in that language, or refuse one that is wrong for
the card, until Wikidata mends it. English and Swedish text is
unchanged, and every card names its items as dcterms:subject.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the cards of nordic-trees in English or Swedish.
Version 3 adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers each species' common name on the front; the
scientific name on the back stays as it is, and a label that is a
scientific name, now or formerly, is not taken for a translation.

Of the 46 cards, 24 have Korean, 46 German, 2 Spanish and 25 French. The
rest lack a label in that language, or refuse one that is wrong for the
card, until Wikidata mends it. English and Swedish text is unchanged,
and every card names its items as dcterms:subject.

Refs: #284
The releases test checked that deleting an instance keeps its release
with a GET whose body it never read. Once the release document grew
past 64 KiB (the brightest stars' next version describes every earlier
version, and the deck's version 3 makes it about 70 KB), the unread body
filled the fetch's buffer and paused its parser; the server then closed
the connection, which the harness asks of every request, and Node 24's
undici failed an internal assertion outside any test
(nodejs/undici#5360, fixed in undici 8). Every test passed, yet the
pod jobs of the Community Solid Servers failed on the unhandled error.

A HEAD request asks what the check needs, as the same test does a few
lines up, and reads no body.

Refs: #284
Someone studying in Korean, German, Spanish or French saw the app in
their language but the brightest stars in English or Swedish. Version 3
adds those four languages from Wikidata's labels, made by
scripts/wikidata_labels.py from a mapping of the cards to the items they
name, which covers each star's constellation, and the star's own name
where no language's label is its Bayer designation, which would give the
answer away. All 52 cards have all four on what the mapping makes.
English and Swedish text is unchanged, and every card names its items as
dcterms:subject.

The library-upgrade journey updates a copy of release 1 to the newest
release, which is now release 3: the offer changes every card as well
as the name, description and keywords, and lists both releases' notes.
The Studio's panel lists the changed cards too, so its page object
reads the notes from the panel's first list.

Closes: #284
@ixuz
ixuz added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit 8d03ffc Oct 24, 2026
35 checks passed
@ixuz
ixuz deleted the wikidata-labels branch October 24, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deck A wrong card, a missing card, or a new deck enhancement New feature or request i18n

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Most library cards have no Korean, German, Spanish or French text

1 participant