From 3bbb659980b4160055df03355d7a933ba211d0df Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sun, 10 Aug 2025 20:23:22 +0200 Subject: Add country name translations --- GNUmakefile | 12 +++++++----- data/country-info | 44 ++++++++++++++++++++++---------------------- lib.m4 | 4 +++- scripts/tr | 6 ++++++ src/euro/index.ccoins.gsp | 9 ++++----- src/style.css | 7 +++++++ src/world/coins/br/index.gsp | 7 +++++-- src/world/coins/us/index.gsp | 2 +- src/world/notes/ez/index.gsp | 4 ++-- 9 files changed, 57 insertions(+), 38 deletions(-) create mode 100755 scripts/tr diff --git a/GNUmakefile b/GNUmakefile index 6807748..b8f5183 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -45,6 +45,7 @@ eurotndeps := src/euro/index.tnotes.gsp src/euro/nav.dnotes.gsp data/notes # Macros to get data to pass to m4 altnames = $(shell awk 'BEGIN { FS = "\t" } $$1 == toupper("$1") { print $$4 }' data/country-info) +name = $(shell awk 'BEGIN { FS = "\t" } $$1 == toupper("$1") { print $$3 }' data/country-info) demonym = $(shell awk 'BEGIN { FS = "\t" } $$1 == toupper("$1") { print $$2 }' data/country-info) percentage = $(shell ./scripts/gen-stats $1) @@ -67,10 +68,11 @@ out/%.html: src/%.gsp $(gspdeps) m4 -P lib.m4 $< | gsp >$@ $(eurocc): out/euro/%/index.html: $(gspdeps) $(euroccdeps) - m4 -P -D__coins -D__code=$* \ - -D__demonym="$(call demonym,$*)" \ - -D__altnames="$(call altnames,$*)" \ - -D__percentage="$(call percentage,$*)" \ + m4 -P -D__coins -D__code=$* \ + -D__demonym="$(call demonym,$*)" \ + -D__name="$(call name,$*)" \ + -D__altnames="$(call altnames,$*)" \ + -D__percentage="$(call percentage,$*)" \ lib.m4 src/euro/index.ccoins.gsp | gsp >$@ $(eurocd): out/euro/%/index.html: $(eurocddeps) $(gspdeps) @@ -99,4 +101,4 @@ clean: serve: darkhttpd out --daemon -.PHONY: all check clean serve +.PHONY: all check clean serve \ No newline at end of file diff --git a/data/country-info b/data/country-info index 1b5d033..a3445aa 100644 --- a/data/country-info +++ b/data/country-info @@ -1,31 +1,31 @@ AD Andorran Andorra -AT Austrian Austria Österreich -BE Belgian Belgium België / Belgique / Belgien -BG Bulgarian Bulgaria България -CY Cypriot Cyprus Κύπρος / Kıbrıs -DE German Germany Deutschland -DE-R German Germany Deutschland -DE-W German Germany Deutschland -DE-X German Germany Deutschland -EE Estonian Estonia Eesti -ES Spanish Spain España -FI Finnish Finland Suomi +AT Austrian Austria de:Österreich +BE Belgian Belgium nl:België,fr:Belgique,de:Belgien +BG Bulgarian Bulgaria bg:България +CY Cypriot Cyprus el:Κύπρος,tr:Kıbrıs +DE German Germany de:Deutschland +DE-R German Germany de:Deutschland +DE-W German Germany de:Deutschland +DE-X German Germany de:Deutschland +EE Estonian Estonia ee:Eesti +ES Spanish Spain es:España +FI Finnish Finland fi:Suomi FR French France FR-E French France FR-U French France -GR Greek Greece Ελλάδα -HR Croatian Croatia Hrvatska -IE Irish Ireland Éire -IT Italian Italy Italia -LT Lithuanian Lithuania Lietuva -LU Luxembourgish Luxembourg Lëtzebuerg / Luxemburg -LV Latvian Latvia Latvija +GR Greek Greece el:Ελλάδα +HR Croatian Croatia hr:Hrvatska +IE Irish Ireland ga:Éire +IT Italian Italy it:Italia +LT Lithuanian Lithuania lt:Lietuva +LU Luxembourgish Luxembourg lb:Lëtzebuerg,de:Luxemburg +LV Latvian Latvia lv:Latvija MC Monégasque Monaco MT Maltese Malta -NL Dutch Netherlands Nederland +NL Dutch Netherlands nl:Nederland PT Portuguese Portugal -SI Slovene Slovenia Slovenija -SK Slovak Slovakia Slovensko +SI Slovene Slovenia sl:Slovenija +SK Slovak Slovakia sk:Slovensko SM Sammarinese San Marino US American United States of America -VA Vatican Vatican City Città del Vaticano +VA Vatican Vatican City it:Città del Vaticano,la:Civitas Vaticana \ No newline at end of file diff --git a/lib.m4 b/lib.m4 index 02ae9ef..b90dc45 100644 --- a/lib.m4 +++ b/lib.m4 @@ -11,7 +11,7 @@ m4_define(__ifextra, [ ]) m4_dnl Execute the script ‘$1’ in the ‘scripts/’ directory -m4_define(__esyscmd, [m4_esyscmd([scripts/$1])]) +m4_define(__esyscmd, [m4_esyscmd([scripts/$*])]) m4_dnl Include the file ‘$1’ in the ‘src/’ directory, while also keeping track m4_dnl of who called ‘__include’. This is required sometimes when expanding @@ -58,3 +58,5 @@ m4_define(__entry, [ } } ]) + +m4_define(__tr, [__esyscmd(tr "$*")]) \ No newline at end of file diff --git a/scripts/tr b/scripts/tr new file mode 100755 index 0000000..63e600b --- /dev/null +++ b/scripts/tr @@ -0,0 +1,6 @@ +#!/bin/sh + +echo "$1" | sed -E ' + s/((..):([^,]+))/@span lang="\2" .translation {-\3}/g + s/,//g +' \ No newline at end of file diff --git a/src/euro/index.ccoins.gsp b/src/euro/index.ccoins.gsp index ae16426..4f1392b 100644 --- a/src/euro/index.ccoins.gsp +++ b/src/euro/index.ccoins.gsp @@ -15,10 +15,9 @@ html lang="en" { main { section { header { - h1 {-__demonym Euro Coins} - h3 { - span {-__altnames} - span {-__percentage} + h1 {= + __name + __tr(__altnames) } } } @@ -150,4 +149,4 @@ html lang="en" { section { __include(foot.gsp) } } } -} +} \ No newline at end of file diff --git a/src/style.css b/src/style.css index e5df586..c72908b 100644 --- a/src/style.css +++ b/src/style.css @@ -222,8 +222,11 @@ nav ul > * { } header h1 { + display: flex; + flex-direction: column; font-size: 1.5rem; margin-bottom: 0; + line-height: 1.1; } header h3 { @@ -887,3 +890,7 @@ div .country-table:not(:first-child) { flex-direction: column; align-items: center; } + +.translation { + opacity: 50%; +} \ No newline at end of file diff --git a/src/world/coins/br/index.gsp b/src/world/coins/br/index.gsp index 0045ff3..2e9950b 100644 --- a/src/world/coins/br/index.gsp +++ b/src/world/coins/br/index.gsp @@ -13,7 +13,10 @@ html lang="en" { main { section { header { - h1 {-Brazilian Coins} + h1 {= + Brazil + @span lang="pt" .translation {-Brasil} + } } } @@ -80,4 +83,4 @@ html lang="en" { section { __include(foot.gsp) } } } -} +} \ No newline at end of file diff --git a/src/world/coins/us/index.gsp b/src/world/coins/us/index.gsp index 62de70b..6d27e25 100644 --- a/src/world/coins/us/index.gsp +++ b/src/world/coins/us/index.gsp @@ -13,7 +13,7 @@ html lang="en" { main { section { header { - h1 {-American Coins} + h1 {-United States of America} } } diff --git a/src/world/notes/ez/index.gsp b/src/world/notes/ez/index.gsp index c62db8c..5139cad 100644 --- a/src/world/notes/ez/index.gsp +++ b/src/world/notes/ez/index.gsp @@ -13,7 +13,7 @@ html lang="en" { main { section { header { - h1 {-Eurozone Banknotes} + h1 {-Eurozone} } } @@ -57,4 +57,4 @@ html lang="en" { section { __include(foot.gsp) } } } -} +} \ No newline at end of file -- cgit v1.2.3