translations and language specific templates implementation

This commit is contained in:
sejo 2022-03-27 19:19:32 -06:00
parent 5190019fc3
commit 870066ef79
19 changed files with 91 additions and 32 deletions

View File

@ -14,11 +14,21 @@ templates = {
footer = { path = "pagefooter.html", template = ""},
incoming = { path = "pageincoming.html", template = ""}
},
webEs = {
header = { path = "pageheader.html", template = ""},
footer = { path = "pagefooter_es.html", template = ""},
incoming = { path = "pageincoming_es.html", template = ""}
},
gemEn = {
header = { path = "pageheader.gmi", template = ""},
footer = { path = "pagefooter.gmi", template = ""},
incoming = { path = "pageincoming.gmi", template = ""}
},
gemEs = {
header = { path = "pageheader.gmi", template = ""},
footer = { path = "pagefooter_es.gmi", template = ""},
incoming = { path = "pageincoming_es.gmi", template = ""}
},
}
pages = {}
@ -127,7 +137,27 @@ function firstPass()
if line == "" then
pagemeta.lang = "en,es-MX" -- default
else
pagemeta.lang, pagemeta.trlang, pagemeta.trname = string.match("^lang=(.-)%s(.-)->(.-)$")
local langformat = "^lang=(%a+)"
local tradformat = "%s(%a+)->(.-)$"
pagemeta.lang = string.match(line,langformat)
local trlang, trname = string.match(line, tradformat)
if trlang ~= nil then
local ttext = "in english:"
if string.match( trlang, "^es" ) then
ttext = "en español:"
end
local weblink = string.format(
"<a href='./%s.html' rel='alternate'>%s</a>",
pages[ trname ].slug, trname )
local gemlink = string.format(
"=> ./%s.gmi %s",
pages[ trname ].slug, trname )
pagemeta.webtranslation = string.format(
"<p id='translation'>%s %s</p>",
ttext, weblink )
pagemeta.gemtranslation = string.format(
"%s\n%s\n", ttext, gemlink)
end
end
elseif count == 3 then -- obtain page description
pagemeta.pdescription,n = string.gsub(line,"[{}]","")
@ -170,7 +200,7 @@ function firstPass()
end
local close = closeTags()
out.web = string.format("%s<h%d>%s</h%d>",close,level,title,level)
out.web = string.format("%s<h%d id='%s'>%s</h%d>",close,level,title,title,level)
elseif string.match( line, "^>") then -- BLOCKQUOTE
local close = closeTags()
@ -189,9 +219,10 @@ function firstPass()
local dest, text = getLink( line )
if string.match( dest, "^%./") then --local links
local t = string.match( text, "^{(.-)}$" )
local htmldest = string.gsub( dest, "gmi", "html" )
if t ~= nil then -- wikilink
local close = closeTags()
out.web = string.format("%s<p><a href='%s' class='arrow'>%s</a></p>",close,dest,t)
out.web = string.format("%s<p><a href='%s' class='arrow'>%s</a></p>",close,htmldest,t)
elseif isImagePath( dest ) then -- images
local img = string.format('<img src="%s" alt="%s" loading="lazy"/>',dest,text)
@ -271,8 +302,14 @@ function firstPass()
pagemeta.navcontent = table.concat( navlines, "\n" )
-- set templates
pagemeta.outs.web.templates = templates.webEn
pagemeta.outs.gem.templates = templates.gemEn
if string.match( pagemeta.lang, "^en" ) then
pagemeta.outs.web.templates = templates.webEn
pagemeta.outs.gem.templates = templates.gemEn
else
pagemeta.outs.web.templates = templates.webEs
pagemeta.outs.gem.templates = templates.gemEs
end
-- fill templates and write results
for key, out in pairs(pagemeta.outs) do
@ -336,6 +373,7 @@ function initPageMetadata( name ) -- return a table with metadata
updatedate = "",
navcontent = "",
gemincoming = "", webincoming = "",
gemtranslation = "", webtranslation = ""
}
meta.outs = {
web = { path = string.format("%s/%s.html", webdir, meta.slug) },

View File

@ -1,9 +1,7 @@
# about
lang=en es->acerca
compudanzas is a research project exploring alternative modes of learning and creating computation.
en español: {acerca}
we attempt to transition from a logic of productivity and efficiency, and circuits that destroy life, to dances, rituals, and other types of seemingly useless computers!
we move calmly, patiently, and with curiosity.

View File

@ -1,9 +1,7 @@
# acerca
lang=es en->about
compudanzas es un proyecto creativo de investigación que explora formas alternativas de aprender y hacer cómputo.
in english: {about}
reimaginamos la computación y sus implicaciones.
tratamos de transicionar desde una lógica de productividad y eficiencia, y circuitos que destruyen vida, hacia danzas, rituales, y otros tipos de computadoras aparentemente inútiles.

View File

@ -1,5 +1,5 @@
# compudanzas ahora
lang=es en->now
en qué andamos aproximadamente en estos momentos:
presentamos {alive computing dance} en el 10 aniversario de algorave, nuestro primer performance que utiliza a la {qiudanz technique}.

View File

@ -1,9 +1,7 @@
# apoyo
lang=es en->support
compudanzas como la práctica de hacer tangible a la computación ha sido un proyecto de ensueño por ya varios años.
in english: {support}
=> ./img/foto_laconsagracion_04.jpg foto de piezas de madera en el suelo manipuladas por algunas manos
¡contribuye a hacerlo posible con tu apoyo económico!

View File

@ -1,5 +1,5 @@
# contact
lang=en es->contacto
let's connect!
our e-mail address: compudanzas at posteo dot net
@ -17,5 +17,3 @@ and in the ssb network, thanks to {la sala}:
see the {log} for non-interactive ways of following our updates.
(in some contexts you can find me as {sejo})
en español: {contacto}

View File

@ -1,5 +1,5 @@
# contacto
lang=es en->contact
¡conectemos!
nuestra dirección de correo-e: compudanzas en posteo dot net
@ -17,5 +17,3 @@ y en la red ssb, gracias a {la sala}:
además, en el {log} hay más opciones no interactivas para seguir nuestras actualizaciones.
(en algunos contextos me puedes encontrar como {sejo})
in english: {contact}

View File

@ -1,5 +1,5 @@
# danzas compuertas
lang=es
antiguas historias hablaban de computar en conjunto, en comunidad.
tareas sencillas y divertidas que requieren atención y presencia y que combinadas dan paso a complejidad, a olas, a cambios.

View File

@ -1,5 +1,5 @@
# now
lang=en es->ahora
what are we up to approximately now.
we just performed {alive computing dance} on the 10th anniversay of algorave, a livecoding performance using the {qiudanz technique}.

View File

@ -1,9 +1,7 @@
# support
lang=en es->apoyo
compudanzas as the practice of making computation tangible in dance and paper has been a dream project for many years now.
en español: {apoyo}
=> ./img/foto_laconsagracion_04.jpg photo of pieces of wood in the floor, with some hands manipulating them
i have decided to transition towards giving the project my full attention and energy.

View File

@ -1,5 +1,5 @@
# tutorial de uxn
lang=es en->uxn tutorial
una guía introductoria y pausada para programar la computadora varvara basada en el núcleo {uxn}.
> El ecosistema de Uxn es un espacio de juego y exploración de computación personal, creado para desarrollar y utilizar pequeñas herramientas y juegos y programable en su propio lenguaje ensamblador.

View File

@ -1,13 +1,11 @@
# uxn tutorial
lang=en es->tutorial de uxn
welcome to this beginner's, slow-paced and comprehensive guide for programming the varvara computer based on the {uxn} core.
you can get an offline version of this guide as the {introduction to uxn programming book}!
if you prefer video, you can watch a short {intro to uxn programming} workshop that we taught as an introduction.
there's a translation to spanish: {tutorial de uxn}
# day 1
in this first section of the tutorial we talk about the basics of the uxn computer called varvara, its programming paradigm in a language called uxntal, its architecture, and why you would want to learn to program it.

View File

@ -90,6 +90,13 @@ table td {
td.num{
text-align:right;
}
#translation{
font-size: smaller;
font-style: italic;
}
#incoming{
font-size: smaller;
}
/* desktop */
@media screen and (min-width: 600px) {

View File

@ -0,0 +1,5 @@
# meta
=> ./home.gmi {title}
=> ./contacto.gmi contacto
=> https://endefensadelsl.org/ppl_deed_es.html textos, imágenes y código compartidos bajo la licencia de producción de pares

View File

@ -0,0 +1,15 @@
</main>
<footer>
<p>
<a href='https://tildegit.org/sejo/compudanzas/src/branch/main/src/{slug}.gmo' rel='external noreferrer noopener' target=_blank>archivo fuente</a> &mdash;
actualización más reciente::
<time datetime='{updatedate}'>1{updatedate}</time> &mdash;
<a href='gemini://{domain}/{slug}.gmi' rel='external noreferrer noopener' target=_blank>en gemini://</a>
</p>
<hr/>
<p><a href='./acerca.html'>acerca</a> <a href='./contacto.html'>contacto</a> <a href='./apoyo.html'>apoyo</a></p>
<p><a class='icon' href='./home.html' title='{title}'><img src='./img/iconocompudanzas_32.png' width=32 height=32 alt='icono de compudanzas'/></a>
<a href='https://webring.xxiivv.com/#random' target='_blank' title='webring' class='icon'><img src='./img/icon.black.svg' width='32' height='32' alt='xxiivv webring'/></a></p>
<p>textos, imágenes y código compartidos bajo la <a href='https://endefensadelsl.org/ppl_deed_es.html' target=_blank rel='external noreferrer noopener' title='licencia de producción de pares'>licencia de producción de pares</a></p>
</footer>
</body>

View File

@ -1,2 +1,2 @@
# {ptitle}
{gemtranslation}

View File

@ -20,8 +20,9 @@
</head>
<body>
<header>
<p><a class='icon' href='./home.html' title='{title}'><img src='./img/iconocompudanzas_32.png' style='margin:0' alt='icono de compudanzas'/></a></p>
<p><a class='icon' href='./home.html' title='{title}'><img src='./img/iconocompudanzas_32.png' style='margin:0' alt='{title}'/></a></p>
<h1>{ptitle}</h1>
{webtranslation}
</header>
<nav>
{navcontent}

View File

@ -0,0 +1,3 @@
# enlaces entrantes
{gemincoming}

View File

@ -0,0 +1,4 @@
<section id='incoming'>
<h1>enlaces entrantes</h1>
{webincoming}
</section>