From c60251ec546224a7eef10fd873c56fd1e3caadd1 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 1 Aug 2025 20:50:38 +0200 Subject: Use context for country names --- src/countries.go | 50 +++++++++--------- src/templates/banknotes-codes.html.tmpl | 90 ++++++++++++++++----------------- 2 files changed, 70 insertions(+), 70 deletions(-) (limited to 'src') diff --git a/src/countries.go b/src/countries.go index d209c65..8e69f50 100644 --- a/src/countries.go +++ b/src/countries.go @@ -15,32 +15,32 @@ type country struct { func sortedCountries(p i18n.Printer) []country { xs := []country{ - {Code: "ad", Name: p.Get("Andorra")}, - {Code: "at", Name: p.Get("Austria")}, - {Code: "be", Name: p.Get("Belgium")}, + {Code: "ad", Name: p.GetC("Andorra", "Country Name")}, + {Code: "at", Name: p.GetC("Austria", "Country Name")}, + {Code: "be", Name: p.GetC("Belgium", "Country Name")}, /* TODO(2026): Add Bulgaria */ - /* {Code: "bg", Name: p.Get("Bulgaria")}, */ - {Code: "cy", Name: p.Get("Cyprus")}, - {Code: "de", Name: p.Get("Germany")}, - {Code: "ee", Name: p.Get("Estonia")}, - {Code: "es", Name: p.Get("Spain")}, - {Code: "fi", Name: p.Get("Finland")}, - {Code: "fr", Name: p.Get("France")}, - {Code: "gr", Name: p.Get("Greece")}, - {Code: "hr", Name: p.Get("Croatia")}, - {Code: "ie", Name: p.Get("Ireland")}, - {Code: "it", Name: p.Get("Italy")}, - {Code: "lt", Name: p.Get("Lithuania")}, - {Code: "lu", Name: p.Get("Luxembourg")}, - {Code: "lv", Name: p.Get("Latvia")}, - {Code: "mc", Name: p.Get("Monaco")}, - {Code: "mt", Name: p.Get("Malta")}, - {Code: "nl", Name: p.Get("Netherlands")}, - {Code: "pt", Name: p.Get("Portugal")}, - {Code: "si", Name: p.Get("Slovenia")}, - {Code: "sk", Name: p.Get("Slovakia")}, - {Code: "sm", Name: p.Get("San Marino")}, - {Code: "va", Name: p.Get("Vatican City")}, + /* {Code: "bg", Name: p.GetC("Bulgaria", "Country Name")}, */ + {Code: "cy", Name: p.GetC("Cyprus", "Country Name")}, + {Code: "de", Name: p.GetC("Germany", "Country Name")}, + {Code: "ee", Name: p.GetC("Estonia", "Country Name")}, + {Code: "es", Name: p.GetC("Spain", "Country Name")}, + {Code: "fi", Name: p.GetC("Finland", "Country Name")}, + {Code: "fr", Name: p.GetC("France", "Country Name")}, + {Code: "gr", Name: p.GetC("Greece", "Country Name")}, + {Code: "hr", Name: p.GetC("Croatia", "Country Name")}, + {Code: "ie", Name: p.GetC("Ireland", "Country Name")}, + {Code: "it", Name: p.GetC("Italy", "Country Name")}, + {Code: "lt", Name: p.GetC("Lithuania", "Country Name")}, + {Code: "lu", Name: p.GetC("Luxembourg", "Country Name")}, + {Code: "lv", Name: p.GetC("Latvia", "Country Name")}, + {Code: "mc", Name: p.GetC("Monaco", "Country Name")}, + {Code: "mt", Name: p.GetC("Malta", "Country Name")}, + {Code: "nl", Name: p.GetC("Netherlands", "Country Name")}, + {Code: "pt", Name: p.GetC("Portugal", "Country Name")}, + {Code: "si", Name: p.GetC("Slovenia", "Country Name")}, + {Code: "sk", Name: p.GetC("Slovakia", "Country Name")}, + {Code: "sm", Name: p.GetC("San Marino", "Country Name")}, + {Code: "va", Name: p.GetC("Vatican City", "Country Name")}, } c := collate.New(language.MustParse(p.Bcp)) slices.SortFunc(xs, func(x, y country) int { diff --git a/src/templates/banknotes-codes.html.tmpl b/src/templates/banknotes-codes.html.tmpl index a921644..2ff6395 100644 --- a/src/templates/banknotes-codes.html.tmpl +++ b/src/templates/banknotes-codes.html.tmpl @@ -58,67 +58,67 @@ D - {{ .Get "Estonia" }} + {{ .GetC "Estonia" "Country Name" }} E - {{ .Get "Slovakia" }} + {{ .GetC "Slovakia" "Country Name" }} F - {{ .Get "Malta" }} + {{ .GetC "Malta" "Country Name" }} G - {{ .Get "Cyprus" }} + {{ .GetC "Cyprus" "Country Name" }} H - {{ .Get "Slovenia" }} + {{ .GetC "Slovenia" "Country Name" }} L - {{ .Get "Finland" }} + {{ .GetC "Finland" "Country Name" }} M - {{ .Get "Portugal" }} + {{ .GetC "Portugal" "Country Name" }} N - {{ .Get "Austria" }} + {{ .GetC "Austria" "Country Name" }} P - {{ .Get "Netherlands" }} + {{ .GetC "Netherlands" "Country Name" }} S - {{ .Get "Italy" }} + {{ .GetC "Italy" "Country Name" }} T - {{ .Get "Ireland" }} + {{ .GetC "Ireland" "Country Name" }} U - {{ .Get "France" }} + {{ .GetC "France" "Country Name" }} V - {{ .Get "Spain" }} + {{ .GetC "Spain" "Country Name" }} X - {{ .Get "Germany" }} + {{ .GetC "Germany" "Country Name" }} Y - {{ .Get "Greece" }} + {{ .GetC "Greece" "Country Name" }} Z - {{ .Get "Belgium" }} + {{ .GetC "Belgium" "Country Name" }} @@ -138,17 +138,17 @@ D - {{ .Get "Finland" }} + {{ .GetC "Finland" "Country Name" }} SETEC E - {{ .Get "France" }} + {{ .GetC "France" "Country Name" }} Oberthur F - {{ .Get "Austria" }} + {{ .GetC "Austria" "Country Name" }} Österreichische Banknoten- und Sicherheitsdruck GmbH @@ -157,57 +157,57 @@ G - {{ .Get "Netherlands" }} + {{ .GetC "Netherlands" "Country Name" }} Koninklijke Joh. Enschedé H - {{ .Get "United Kingdom" }} + {{ .GetC "United Kingdom" "Country Name" }} De La Rue J - {{ .Get "Italy" }} + {{ .GetC "Italy" "Country Name" }} {{ .Get "Bank of Italy" }} K - {{ .Get "Ireland" }} + {{ .GetC "Ireland" "Country Name" }} {{ .Get "Central Bank of Ireland" }} L - {{ .Get "France" }} + {{ .GetC "France" "Country Name" }} {{ .Get "Bank of France" }} M - {{ .Get "Spain" }} + {{ .GetC "Spain" "Country Name" }} {{ .Get "Royal Mint of Spain" }} N - {{ .Get "Greece" }} + {{ .GetC "Greece" "Country Name" }} {{ .Get "Bank of Greece" }} P - {{ .Get "Germany" }} + {{ .GetC "Germany" "Country Name" }} Giesecke+Devrient GmbH R - {{ .Get "Germany" }} + {{ .GetC "Germany" "Country Name" }} Bundesdruckerei GmbH T - {{ .Get "Belgium" }} + {{ .GetC "Belgium" "Country Name" }} {{ .Get "National Bank of Belgium" }} U - {{ .Get "Portugal" }} + {{ .GetC "Portugal" "Country Name" }} Valora S.A. @@ -227,22 +227,22 @@ E - {{ .Get "France" }} + {{ .GetC "France" "Country Name" }} Oberthur F - {{ .Get "Bulgaria" }} + {{ .GetC "Bulgaria" "Country Name" }} Oberthur Fiduciaire AD M - {{ .Get "Portugal" }} + {{ .GetC "Portugal" "Country Name" }} Valora S.A. N - {{ .Get "Austria" }} + {{ .GetC "Austria" "Country Name" }} Österreichische Banknoten- und Sicherheitsdruck GmbH @@ -251,52 +251,52 @@ P - {{ .Get "Netherlands" }} + {{ .GetC "Netherlands" "Country Name" }} Koninklijke Joh. Enschedé R - {{ .Get "Germany" }} + {{ .GetC "Germany" "Country Name" }} Bundesdruckerei GmbH S - {{ .Get "Italy" }} + {{ .GetC "Italy" "Country Name" }} {{ .Get "Bank of Italy" }} T - {{ .Get "Ireland" }} + {{ .GetC "Ireland" "Country Name" }} {{ .Get "Central Bank of Ireland" }} U - {{ .Get "France" }} + {{ .GetC "France" "Country Name" }} {{ .Get "Bank of France" }} V - {{ .Get "Spain" }} + {{ .GetC "Spain" "Country Name" }} {{ .Get "Royal Mint of Spain" }} W - {{ .Get "Germany" }} + {{ .GetC "Germany" "Country Name" }} Giesecke+Devrient GmbH {{ .Get "Leipzig" }} X - {{ .Get "Germany" }} + {{ .GetC "Germany" "Country Name" }} Giesecke+Devrient GmbH {{ .Get "Munich" }} Y - {{ .Get "Greece" }} + {{ .GetC "Greece" "Country Name" }} {{ .Get "Bank of Greece" }} Z - {{ .Get "Belgium" }} + {{ .GetC "Belgium" "Country Name" }} {{ .Get "National Bank of Belgium" }} @@ -316,4 +316,4 @@ alt={{ $p.GetN "Printer code on a {N} euro bill" "Printer code on a {N} euro bill" $d $args }} > -{{ end }} +{{ end }} \ No newline at end of file -- cgit v1.2.3