From 03c58e7bbff19e4609b7e3d87b12ff6806a4c9d8 Mon Sep 17 00:00:00 2001 From: Claudia Asti Date: Wed, 3 Jun 2026 10:56:52 +0200 Subject: [PATCH 1/3] feat: add cantons to organisation list --- src/app/components/Editor.tsx | 2 +- src/app/data/README.md | 5 + src/app/data/cantons.json | 560 ++++++++++++++++++++++++++ src/app/data/generateOrganisations.ts | 47 ++- src/app/data/organisations.json | 245 +++++++++++ 5 files changed, 855 insertions(+), 4 deletions(-) create mode 100644 src/app/data/cantons.json diff --git a/src/app/components/Editor.tsx b/src/app/components/Editor.tsx index bbd03a78..7b1a7213 100644 --- a/src/app/components/Editor.tsx +++ b/src/app/components/Editor.tsx @@ -167,7 +167,7 @@ export default function Editor() { data.organisations.map(organisation => ({ text: getLocalizedText(organisation.name, i18n.language) + (organisation.alternativeName ? ` (${getLocalizedText(organisation.alternativeName, i18n.language)})` : ""), value: organisation.id, - group: `${getLocalizedText(data.name, i18n.language)} (${getLocalizedText(data.abbreviation, i18n.language)})`, + group: getLocalizedText(data.name, i18n.language) + (data.abbreviation ? ` (${getLocalizedText(data.abbreviation, i18n.language)})` : ''), })) ); diff --git a/src/app/data/README.md b/src/app/data/README.md index c557665f..5fd04244 100644 --- a/src/app/data/README.md +++ b/src/app/data/README.md @@ -14,6 +14,11 @@ https://ld.admin.ch/sparql/#query=PREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.or https://ld.admin.ch/sparql/#query=PREFIX%20schema%3A%20%3Chttp%3A%2F%2Fschema.org%2F%3E%0APREFIX%20rdf%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0APREFIX%20rdfs%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0ASELECT%20DISTINCT%20%3Fdepartment%20%3FnameDepDe%20%3FnameDepFr%20%3FnameDepIt%20%3FnameDepEn%20%3FaltNameDepDe%20%3FaltNameDepFr%20%3FaltNameDepIt%20%3FaltNameDepEn%20%3Foffice%20%3FnameDe%20%3FnameFr%20%3FnameIt%20%3FnameEn%20%3FaltNameDe%20%3FaltNameFr%20%3FaltNameIt%20%3FaltNameEn%20WHERE%20%7B%0A%20%0A%20%20%3Foffice%20schema%3AinDefinedTermSet%20%3Chttps%3A%2F%2Fld.admin.ch%2Foffice%3E.%0A%20%20%3Foffice%20schema%3AparentOrganization%20%3Fdepartment.%0A%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameDe.%20FILTER(lang(%3FnameDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameFr.%20FILTER(lang(%3FnameFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameIt.%20FILTER(lang(%3FnameIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3Aname%20%3FnameEn.%20FILTER(lang(%3FnameEn)%20%3D%20%22en%22)%20%7D%0A%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameDe.%20FILTER(lang(%3FaltNameDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameFr.%20FILTER(lang(%3FaltNameFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameIt.%20FILTER(lang(%3FaltNameIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Foffice%20schema%3AalternateName%20%3FaltNameEn.%20FILTER(lang(%3FaltNameEn)%20%3D%20%22en%22)%20%7D%0A%20%20%0A%20%20%3Fdepartment%20schema%3AinDefinedTermSet%20%3Chttps%3A%2F%2Fld.admin.ch%2Fdepartment%3E.%0A%20%20%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepDe.%20FILTER(lang(%3FnameDepDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepFr.%20FILTER(lang(%3FnameDepFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepIt.%20FILTER(lang(%3FnameDepIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3Aname%20%3FnameDepEn.%20FILTER(lang(%3FnameDepEn)%20%3D%20%22en%22)%20%7D%0A%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepDe.%20FILTER(lang(%3FaltNameDepDe)%20%3D%20%22de%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepFr.%20FILTER(lang(%3FaltNameDepFr)%20%3D%20%22fr%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepIt.%20FILTER(lang(%3FaltNameDepIt)%20%3D%20%22it%22)%20%7D%0A%20%20OPTIONAL%20%7B%20%3Fdepartment%20schema%3AalternateName%20%3FaltNameDepEn.%20FILTER(lang(%3FaltNameDepEn)%20%3D%20%22en%22)%20%7D%0A%0A%7D%0A&endpoint=https%3A%2F%2Fld.admin.ch%2Fquery&requestMethod=POST&tabTitle=Query&headers=%7B%7D&contentTypeConstruct=text%2Fturtle&contentTypeSelect=application%2Fsparql-results%2Bjson&outputFormat=table&outputSettings=%7B%22pageSize%22%3A-1%7D ``` +- The swiss cantons (`cantons.json`) +``` +https://ld.admin.ch/sparql/#query=SELECT%20*%20WHERE%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%3FcantonUri%20a%20%3Chttps%3A%2F%2Fschema.ld.admin.ch%2FCanton%3E%20%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20OPTIONAL%20%7B%20%3FcantonUri%20%3Chttp%3A%2F%2Fschema.org%2Fname%3E%20%3FnameDe%20.%20FILTER%20(lang(%3FnameDe)%20%3D%20%22de%22)%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20OPTIONAL%20%7B%20%3FcantonUri%20%3Chttp%3A%2F%2Fschema.org%2Fname%3E%20%3FnameFr%20.%20FILTER%20(lang(%3FnameFr)%20%3D%20%22fr%22)%20%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20OPTIONAL%20%7B%20%3FcantonUri%20%3Chttp%3A%2F%2Fschema.org%2Fname%3E%20%3FnameIt%20.%20FILTER%20(lang(%3FnameIt)%20%3D%20%22it%22)%20%7D%0A%20%20%20%20%20%20%20%20%7D&endpoint=https%3A%2F%2Fld.admin.ch%2Fquery&requestMethod=POST&tabTitle=Query&headers=%7B%7D&contentTypeConstruct=application%2Fn-triples%2C*%2F*%3Bq%3D0.9&contentTypeSelect=application%2Fsparql-results%2Bjson%2C*%2F*%3Bq%3D0.9&outputFormat=table +``` + Additionally, some special cases are added in `additional-organisations.json`. These are organisations are part of organisations returned in the above queries and must be added manually. It would be possible to fetch all organisations recursevely with the above queries, but that would yield too many organisations! diff --git a/src/app/data/cantons.json b/src/app/data/cantons.json new file mode 100644 index 00000000..0a55f963 --- /dev/null +++ b/src/app/data/cantons.json @@ -0,0 +1,560 @@ +{ + "head": { + "vars": [ + "cantonUri", + "nameDe", + "nameFr", + "nameIt" + ] + }, + "results": { + "bindings": [ + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/20" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Thurgau" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Thurgovie" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Turgovia" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/13" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Basel-Landschaft" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Bâle-Campagne" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Basilea Campagna" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/17" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "St. Gallen" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Saint-Gall" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "San Gallo" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/19" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Aargau" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Argovie" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Argovia" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/11" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Solothurn" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Soleure" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Soletta" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/21" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Tessin" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Tessin" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Ticino" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/18" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Graubünden" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Grisons" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Grigioni" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/6" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Obwalden" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Obwald" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Obvaldo" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/9" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Zug" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Zoug" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Zugo" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/3" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Luzern" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Lucerne" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Lucerna" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/5" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Schwyz" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Schwyz" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Svitto" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/2" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Bern" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Berne" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Berna" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/22" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Waadt" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Vaud" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Vaud" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/1" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Zürich" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Zurich" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Zurigo" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/26" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Jura" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Jura" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Giura" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/23" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Wallis" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Valais" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Vallese" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/24" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Neuenburg" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Neuchâtel" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Neuchâtel" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/14" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Schaffhausen" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Schaffhouse" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Sciaffusa" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/10" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Freiburg" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Fribourg" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Friburgo" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/15" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Appenzell Ausserrhoden" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Appenzell Rhodes-Extérieures" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Appenzello Esterno" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/16" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Appenzell Innerrhoden" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Appenzell Rhodes-Intérieures" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Appenzello Interno" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/8" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Glarus" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Glaris" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Glarona" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/4" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Uri" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Uri" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Uri" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/12" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Basel-Stadt" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Bâle-Ville" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Basilea Città" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/25" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Genf" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Genève" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Ginevra" + } + }, + { + "cantonUri": { + "type": "uri", + "value": "https://ld.admin.ch/canton/7" + }, + "nameDe": { + "xml:lang": "de", + "type": "literal", + "value": "Nidwalden" + }, + "nameFr": { + "xml:lang": "fr", + "type": "literal", + "value": "Nidwald" + }, + "nameIt": { + "xml:lang": "it", + "type": "literal", + "value": "Nidvaldo" + } + } + ] + } +} \ No newline at end of file diff --git a/src/app/data/generateOrganisations.ts b/src/app/data/generateOrganisations.ts index bac96e2e..2f9708e0 100644 --- a/src/app/data/generateOrganisations.ts +++ b/src/app/data/generateOrganisations.ts @@ -30,6 +30,17 @@ interface OfficeBinding { altNameEn?: SPARQLBinding; } +interface CantonResult { + results: { + bindings: { + cantonUri: SPARQLBinding; + nameDe: SPARQLBinding; + nameFr: SPARQLBinding; + nameIt: SPARQLBinding; + }[]; + }; +} + interface SPARQLResult { results: { bindings: OfficeBinding[]; @@ -52,19 +63,26 @@ interface Organisation { interface Department { id: string; name: MultilingualName; - abbreviation: MultilingualName; + abbreviation?: MultilingualName; organisations: Organisation[]; } +interface Canton { + id: string; + name: MultilingualName; +} + function generateOrganisations(): void { const officesPath = path.join(__dirname, 'offices.json'); const departementsPath = path.join(__dirname, 'departements.json'); const additionalOrganisationsPath = path.join(__dirname, 'additional-organisations.json'); + const cantonsPath = path.join(__dirname, 'cantons.json'); const outputPath = path.join(__dirname, 'organisations.json'); const officesData: SPARQLResult = JSON.parse(fs.readFileSync(officesPath, 'utf-8')); const departementsData: SPARQLResult = JSON.parse(fs.readFileSync(departementsPath, 'utf-8')); const additionalOrganisationsData: { id: string; organisations: Organisation[] }[] = JSON.parse(fs.readFileSync(additionalOrganisationsPath, 'utf-8')); + const cantonsData: CantonResult = JSON.parse(fs.readFileSync(cantonsPath, 'utf-8')); // Group offices by department const departmentMap = new Map ({ + id: canton.cantonUri.value, + name: { + de: canton.nameDe.value, + fr: canton.nameFr.value, + it: canton.nameIt.value, + en: canton.nameDe.value, + }, + })); + + departments.push({ + id: 'https://ld.admin.ch/canton', + name: { + de: 'Kantone', + fr: 'Cantons', + it: 'Cantoni', + en: 'Cantons', + }, + organisations: cantons, + }); + fs.writeFileSync(outputPath, JSON.stringify(departments, null, 2) + '\n'); console.log(`✓ Successfully generated ${outputPath}`); - console.log(` - ${departments.length} departments`); - console.log(` - ${departments.reduce((sum, d) => sum + d.organisations.length, 0)} organisations`); + console.log(` - ${departments.length - 1} departments`); + console.log(` - ${departments.reduce((sum, d) => sum + d.organisations.length, 0) - cantons.length} organisations`); + console.log(` - ${cantons.length} cantons`); } try { diff --git a/src/app/data/organisations.json b/src/app/data/organisations.json index e3d07127..8c72256d 100644 --- a/src/app/data/organisations.json +++ b/src/app/data/organisations.json @@ -1523,5 +1523,250 @@ } } ] + }, + { + "id": "https://ld.admin.ch/canton", + "name": { + "de": "Kantone", + "fr": "Cantons", + "it": "Cantoni", + "en": "Cantons" + }, + "organisations": [ + { + "id": "https://ld.admin.ch/canton/20", + "name": { + "de": "Thurgau", + "fr": "Thurgovie", + "it": "Turgovia", + "en": "Thurgau" + } + }, + { + "id": "https://ld.admin.ch/canton/13", + "name": { + "de": "Basel-Landschaft", + "fr": "Bâle-Campagne", + "it": "Basilea Campagna", + "en": "Basel-Landschaft" + } + }, + { + "id": "https://ld.admin.ch/canton/17", + "name": { + "de": "St. Gallen", + "fr": "Saint-Gall", + "it": "San Gallo", + "en": "St. Gallen" + } + }, + { + "id": "https://ld.admin.ch/canton/19", + "name": { + "de": "Aargau", + "fr": "Argovie", + "it": "Argovia", + "en": "Aargau" + } + }, + { + "id": "https://ld.admin.ch/canton/11", + "name": { + "de": "Solothurn", + "fr": "Soleure", + "it": "Soletta", + "en": "Solothurn" + } + }, + { + "id": "https://ld.admin.ch/canton/21", + "name": { + "de": "Tessin", + "fr": "Tessin", + "it": "Ticino", + "en": "Tessin" + } + }, + { + "id": "https://ld.admin.ch/canton/18", + "name": { + "de": "Graubünden", + "fr": "Grisons", + "it": "Grigioni", + "en": "Graubünden" + } + }, + { + "id": "https://ld.admin.ch/canton/6", + "name": { + "de": "Obwalden", + "fr": "Obwald", + "it": "Obvaldo", + "en": "Obwalden" + } + }, + { + "id": "https://ld.admin.ch/canton/9", + "name": { + "de": "Zug", + "fr": "Zoug", + "it": "Zugo", + "en": "Zug" + } + }, + { + "id": "https://ld.admin.ch/canton/3", + "name": { + "de": "Luzern", + "fr": "Lucerne", + "it": "Lucerna", + "en": "Luzern" + } + }, + { + "id": "https://ld.admin.ch/canton/5", + "name": { + "de": "Schwyz", + "fr": "Schwyz", + "it": "Svitto", + "en": "Schwyz" + } + }, + { + "id": "https://ld.admin.ch/canton/2", + "name": { + "de": "Bern", + "fr": "Berne", + "it": "Berna", + "en": "Bern" + } + }, + { + "id": "https://ld.admin.ch/canton/22", + "name": { + "de": "Waadt", + "fr": "Vaud", + "it": "Vaud", + "en": "Waadt" + } + }, + { + "id": "https://ld.admin.ch/canton/1", + "name": { + "de": "Zürich", + "fr": "Zurich", + "it": "Zurigo", + "en": "Zürich" + } + }, + { + "id": "https://ld.admin.ch/canton/26", + "name": { + "de": "Jura", + "fr": "Jura", + "it": "Giura", + "en": "Jura" + } + }, + { + "id": "https://ld.admin.ch/canton/23", + "name": { + "de": "Wallis", + "fr": "Valais", + "it": "Vallese", + "en": "Wallis" + } + }, + { + "id": "https://ld.admin.ch/canton/24", + "name": { + "de": "Neuenburg", + "fr": "Neuchâtel", + "it": "Neuchâtel", + "en": "Neuenburg" + } + }, + { + "id": "https://ld.admin.ch/canton/14", + "name": { + "de": "Schaffhausen", + "fr": "Schaffhouse", + "it": "Sciaffusa", + "en": "Schaffhausen" + } + }, + { + "id": "https://ld.admin.ch/canton/10", + "name": { + "de": "Freiburg", + "fr": "Fribourg", + "it": "Friburgo", + "en": "Freiburg" + } + }, + { + "id": "https://ld.admin.ch/canton/15", + "name": { + "de": "Appenzell Ausserrhoden", + "fr": "Appenzell Rhodes-Extérieures", + "it": "Appenzello Esterno", + "en": "Appenzell Ausserrhoden" + } + }, + { + "id": "https://ld.admin.ch/canton/16", + "name": { + "de": "Appenzell Innerrhoden", + "fr": "Appenzell Rhodes-Intérieures", + "it": "Appenzello Interno", + "en": "Appenzell Innerrhoden" + } + }, + { + "id": "https://ld.admin.ch/canton/8", + "name": { + "de": "Glarus", + "fr": "Glaris", + "it": "Glarona", + "en": "Glarus" + } + }, + { + "id": "https://ld.admin.ch/canton/4", + "name": { + "de": "Uri", + "fr": "Uri", + "it": "Uri", + "en": "Uri" + } + }, + { + "id": "https://ld.admin.ch/canton/12", + "name": { + "de": "Basel-Stadt", + "fr": "Bâle-Ville", + "it": "Basilea Città", + "en": "Basel-Stadt" + } + }, + { + "id": "https://ld.admin.ch/canton/25", + "name": { + "de": "Genf", + "fr": "Genève", + "it": "Ginevra", + "en": "Genf" + } + }, + { + "id": "https://ld.admin.ch/canton/7", + "name": { + "de": "Nidwalden", + "fr": "Nidwald", + "it": "Nidvaldo", + "en": "Nidwalden" + } + } + ] } ] From 18400ec12fdecddc922abadbfc2d37fa1f34d8c7 Mon Sep 17 00:00:00 2001 From: Claudia Asti Date: Wed, 3 Jun 2026 11:00:13 +0200 Subject: [PATCH 2/3] feat: sort the organisation by localized name --- src/app/components/Editor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/Editor.tsx b/src/app/components/Editor.tsx index 7b1a7213..dec2a98a 100644 --- a/src/app/components/Editor.tsx +++ b/src/app/components/Editor.tsx @@ -168,7 +168,7 @@ export default function Editor() { text: getLocalizedText(organisation.name, i18n.language) + (organisation.alternativeName ? ` (${getLocalizedText(organisation.alternativeName, i18n.language)})` : ""), value: organisation.id, group: getLocalizedText(data.name, i18n.language) + (data.abbreviation ? ` (${getLocalizedText(data.abbreviation, i18n.language)})` : ''), - })) + })).sort((a, b) => a.text.localeCompare(b.text, i18n.language)) ); const { showCountryExtensionVersion, setShowCountryExtensionVersion } = From a93522b490d84bc75d82664e471661c53e7c1d45 Mon Sep 17 00:00:00 2001 From: Claudia Asti Date: Wed, 3 Jun 2026 11:46:09 +0200 Subject: [PATCH 3/3] fix: type error --- src/app/components/Editor.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/Editor.tsx b/src/app/components/Editor.tsx index dec2a98a..845a30f2 100644 --- a/src/app/components/Editor.tsx +++ b/src/app/components/Editor.tsx @@ -165,7 +165,7 @@ export default function Editor() { const organisations = organisationData.flatMap(data => data.organisations.map(organisation => ({ - text: getLocalizedText(organisation.name, i18n.language) + (organisation.alternativeName ? ` (${getLocalizedText(organisation.alternativeName, i18n.language)})` : ""), + text: getLocalizedText(organisation.name, i18n.language) + ('alternativeName' in organisation && organisation.alternativeName ? ` (${getLocalizedText(organisation.alternativeName, i18n.language)})` : ""), value: organisation.id, group: getLocalizedText(data.name, i18n.language) + (data.abbreviation ? ` (${getLocalizedText(data.abbreviation, i18n.language)})` : ''), })).sort((a, b) => a.text.localeCompare(b.text, i18n.language))