From 6f0628af594c58a925192e52dacdae7763a1ec08 Mon Sep 17 00:00:00 2001 From: erseco Date: Sun, 22 Nov 2026 19:50:36 +0000 Subject: [PATCH] Redesign the landing page as eXeLearning for GitHub and add ca, eu, gl, de --- AGENTS.md | 4 +- README.md | 2 +- public/app.css | 90 ++++++--- public/auth/callback.html | 2 +- public/index.html | 58 ++++-- public/setup.html | 2 +- src/app/i18n.ts | 397 +++++++++++++++++++++++++++++++++++++- src/app/main.ts | 8 +- 8 files changed, 494 insertions(+), 69 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index df30cdd..d6b7007 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -35,8 +35,8 @@ eXeLearning (see `RESEARCH.md`, *Path to eXeLearning core*). - **Untrusted input:** ZIPs from the editor go through `readElpx` (path and size limits); paths through `isSafePath`. - Use plain browser APIs and minimal dependencies (runtime: `fflate` only). No frameworks. -- English for code, comments and docs. UI strings live in `src/app/i18n.ts`, in English and - Spanish. +- English for code, comments and docs. UI strings live in `src/app/i18n.ts`, in the editor's + languages (en, es, ca, eu, gl, de); English is the default, the browser language picks the rest. ## Layout diff --git a/README.md b/README.md index 9e3e0a6..05e4178 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# eXeLearning · GitHub +# eXeLearning for GitHub [![CI](https://github.com/exelearning/github-exelearning/actions/workflows/ci.yml/badge.svg)](https://github.com/exelearning/github-exelearning/actions/workflows/ci.yml) [![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](LICENSE) diff --git a/public/app.css b/public/app.css index 95325ad..9c357f5 100644 --- a/public/app.css +++ b/public/app.css @@ -1,31 +1,34 @@ :root { color-scheme: light; - --accent: #00a99d; - --accent-ink: #00756d; /* 4.5:1 for text and button labels */ - --ink: #1f2937; - --muted: #6b7280; - --line: #e5e7eb; + --accent: #00665f; /* 6.9:1 on white: buttons, links, focus */ + --accent-ink: #00665f; + --accent-soft: #e3f1ef; + --ink: #1c2321; + --muted: #5f6966; + --line: #e3e7e6; + --ground: #f7f8f8; font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); } * { box-sizing: border-box; } html, body { margin: 0; height: 100%; } +body { background: var(--ground); } body { display: flex; flex-direction: column; } [hidden] { display: none !important; } -button { font: inherit; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: inherit; cursor: pointer; } +button { font: inherit; padding: 6px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: inherit; cursor: pointer; } #save, button.github, #footer a { display: inline-flex; align-items: center; gap: 8px; } button.github { background: #24292f; border-color: #24292f; color: #fff; font-weight: 600; } button.github:hover { background: #32383f; } .muted { color: var(--muted); } -#footer { margin: 48px 0 24px; font-size: 12px; color: var(--muted); } +#footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin-top: 56px; padding: 24px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); } #footer a { gap: 4px; color: inherit; } button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; } button:disabled { opacity: .5; cursor: default; } button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; } -input { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; min-width: 0; } +input { font: inherit; padding: 7px 10px; border: 1px solid #cfd6d4; border-radius: 8px; min-width: 0; background: #fff; color: inherit; } -#bar { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-bottom: 1px solid var(--line); background: #fff; flex: none; } +#bar { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 12px; border-bottom: 1px solid var(--line); background: #fff; flex: none; } .brand { display: flex; align-items: center; gap: 6px; font-weight: 700; color: inherit; text-decoration: none; } #repo-link { color: var(--muted); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } #repo-link:hover { text-decoration: underline; } @@ -33,7 +36,8 @@ input { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border- #site-link:hover { background: #f3f4f6; } #site-link[hidden] { display: none; } #status { color: var(--muted); white-space: nowrap; } -#status.dirty { color: #b45309; } +#status.dirty { color: #8a4a00; } +#status.dirty::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: #d97706; vertical-align: 1px; } .spacer { flex: 1; } .menu { position: relative; } .menu summary { list-style: none; cursor: pointer; padding: 4px 10px; border-radius: 6px; font-size: 18px; line-height: 1; } @@ -46,11 +50,35 @@ input { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border- #editor { flex: 1; min-height: 0; } #editor iframe { display: block; width: 100%; height: 100%; border: 0; } -#landing { width: 100%; max-width: 640px; margin: 12vh auto 0; padding: 0 20px; } -#landing h1 { display: flex; align-items: center; gap: 10px; font-size: 28px; } -#landing .row { display: flex; gap: 8px; margin-top: 6px; } -#landing .row input { flex: 1; } -#message { color: #b91c1c; min-height: 1.4em; } +#landing { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 24px; font-size: 15px; } +.site-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 20px; padding: 20px 0; } +.site-head .brand { gap: 10px; font-weight: 600; } +.site-head .brand span { color: var(--muted); font-weight: 400; } +.site-head nav { display: flex; align-items: center; gap: 20px; font-size: 14px; } +.site-head nav a { color: var(--muted); text-decoration: none; } +.site-head nav a:hover { color: var(--ink); text-decoration: underline; } +.pill { font-size: 12px; font-weight: 500; color: #8a4a00; background: #fdf1e3; border: 1px solid #f2d6b3; border-radius: 999px; padding: 2px 10px; } +.hero { max-width: 680px; padding: 40px 0 8px; } +.hero h1 { margin: 0 0 16px; font-size: clamp(30px, 5vw, 44px); line-height: 1.12; letter-spacing: -0.02em; } +.hero p { margin: 0; font-size: 18px; line-height: 1.55; color: #4b5552; } +#landing.wide .hero, #landing.wide #how, #landing.wide #how-link { display: none; } +#message:empty { min-height: 0; margin: 8px 0; } +#open-form.compact .row { flex-wrap: nowrap; } +.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 20px; } +.panel { display: flex; flex-direction: column; gap: 12px; padding: 28px; background: #fff; border: 1px solid var(--line); border-radius: 14px; } +.panel h2 { margin: 0; font-size: 18px; } +.panel p { margin: 0; line-height: 1.55; } +#landing .row { display: flex; flex-wrap: wrap; gap: 8px; } +#landing .row input { flex: 1 1 220px; min-height: 44px; padding: 0 14px; } +#landing .row button { min-height: 44px; padding: 0 22px; } +.how { margin-top: 56px; } +.how h2 { margin: 0 0 20px; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); } +.how ol { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; } +.how li { display: flex; gap: 14px; padding-top: 16px; border-top: 1px solid #dfe4e3; } +.how li div { display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.5; color: #4b5552; } +.how li strong { font-size: 15px; color: var(--ink); } +.num { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600; } +#message { color: #b91c1c; min-height: 1.4em; margin: 24px 0 8px; } #message.busy { color: var(--muted); } .busy::before { content: ''; display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; } @@ -76,34 +104,32 @@ button.info { display: inline-flex; border: 0; padding: 4px; background: none; c dialog menu { display: flex; justify-content: flex-end; gap: 8px; padding: 0; margin: 8px 0 0; } #toast { position: fixed; right: 16px; bottom: 16px; max-width: 420px; padding: 12px 16px; background: var(--ink); color: #fff; border-radius: 8px; box-shadow: 0 8px 24px #0003; z-index: 20; } -#toast a { color: #6ee7d8; margin-left: 8px; } +#toast a { color: #7fe0d2; margin-left: 8px; } #toast button { margin-left: 8px; } body.callback { display: grid; place-items: center; color: var(--muted); } -#mine h2 { font-size: 18px; margin: 32px 0 2px; } -#landing.wide { max-width: 960px; } +#mine h2 { font-size: 28px; letter-spacing: -0.01em; margin: 16px 0 4px; } .badge { font-size: 11px; border: 1px solid var(--line); border-radius: 10px; padding: 0 6px; color: var(--muted); } button.link { border: 0; padding: 0; background: none; color: var(--accent); text-decoration: underline; } -dialog fieldset { border: 0; padding: 0; margin: 0 0 8px; } +dialog fieldset { display: flex; flex-direction: column; gap: 8px; border: 0; padding: 0; margin: 0 0 8px; } +dialog fieldset .check { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; } +dialog fieldset .check:has(input:checked) { border-color: var(--accent); background: #f2f8f7; } +dialog input[type=radio], dialog input[type=checkbox] { accent-color: var(--accent); } +dialog { border-radius: 14px; padding: 24px; } #pages-dialog ol { padding-left: 20px; } #pages-dialog li { margin-bottom: 8px; } #pages-dialog a { color: var(--accent); } -.signin-card { margin-top: 28px; padding: 24px 28px; border: 1px solid var(--line); border-radius: 14px; } -.signin-card h2 { margin: 0 0 6px; font-size: 17px; } -.signin-card p { margin: 0 0 14px; line-height: 1.5; } -.signin-card p:last-child { margin: 0; } -button.github { min-height: 44px; padding: 0 18px; font-size: 15px; } -.divider { display: flex; align-items: center; gap: 14px; margin: 28px 0 20px; color: var(--muted); font-size: 13px; } -.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); } -#open-form label { font-weight: 600; } -#open-form .hint { font-size: 13px; margin: 8px 0 0; } -#open-form.compact { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; font-size: 13px; color: var(--muted); } +button.github { min-height: 44px; padding: 0 20px; font-size: 15px; } +#signin-card .muted { flex: 1; } +#open-form label { font-size: 14px; font-weight: 500; color: #4b5552; } +#open-form .hint { font-size: 13px; } +#open-form.compact { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; padding: 0; background: none; border: 0; font-size: 13px; color: var(--muted); } #open-form.compact label { font-weight: normal; } #open-form.compact .row { margin: 0; } -#open-form.compact input { width: 260px; font-size: 13px; padding: 6px 10px; } -#open-form.compact button { font-size: 13px; padding: 6px 12px; background: #fff; color: var(--ink); border-color: var(--line); font-weight: normal; } +#landing #open-form.compact input { flex: 0 1 260px; min-height: 36px; font-size: 13px; padding: 6px 10px; } +#landing #open-form.compact button { min-height: 36px; font-size: 13px; padding: 6px 12px; background: #fff; color: var(--ink); border-color: var(--line); font-weight: normal; } #open-form.compact .hint { display: none; } .resources-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; } .resources-head p { margin: 0; } @@ -137,7 +163,7 @@ button.github { min-height: 44px; padding: 0 18px; font-size: 15px; } .card .actions { display: flex; align-items: center; gap: 14px; font-size: 13px; } .card .actions a { color: var(--accent-ink); } a.button { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 8px; background: var(--accent-ink); color: #fff !important; font-weight: 600; font-size: 14px; text-decoration: none; } -a.button:hover { background: #00524c; } +a.button:hover { background: #004f49; } li.searching { color: var(--muted); font-size: 14px; display: flex; align-items: center; justify-content: center; min-height: 120px; border: 1.5px dashed var(--line); border-radius: 12px; padding: 16px; } .list li.searching { min-height: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; justify-content: flex-start; } #other-repos { margin-top: 20px; font-size: 14px; color: var(--muted); } diff --git a/public/auth/callback.html b/public/auth/callback.html index db71191..0697136 100644 --- a/public/auth/callback.html +++ b/public/auth/callback.html @@ -3,7 +3,7 @@ -eXeLearning · GitHub +eXeLearning for GitHub diff --git a/public/index.html b/public/index.html index c4bf12a..3237dc3 100644 --- a/public/index.html +++ b/public/index.html @@ -3,7 +3,7 @@ -eXeLearning · GitHub +eXeLearning for GitHub @@ -33,24 +33,36 @@
-

eXeLearning · GitHub

-

+
+ eXeLearning for GitHub + +
+
+

+

+
- - -
- -
- - -
-

-
+
+ +
+ + +
+ + +
+

+
+
+
+

+
    +
  1. 1
  2. +
  3. 2
  4. +
  5. 3
  6. +
+
diff --git a/public/setup.html b/public/setup.html index 31b1ff8..c7edcd0 100644 --- a/public/setup.html +++ b/public/setup.html @@ -3,7 +3,7 @@ -eXeLearning · GitHub App setup +eXeLearning for GitHub · App setup diff --git a/src/app/i18n.ts b/src/app/i18n.ts index 23876e0..8dcee09 100644 --- a/src/app/i18n.ts +++ b/src/app/i18n.ts @@ -1,10 +1,21 @@ -// UI strings (English and Spanish); the editor itself follows the browser language too. +// UI strings, one object per language; the editor itself follows the browser language too. const en = { - tagline: 'Edit eXeLearning resources stored on GitHub and save them back to the repository.', + headline: 'Edit eXeLearning resources stored on GitHub, right in your browser', + tagline: 'Open an eXeLearning project from any repository in the official editor and save your changes back as a commit or a pull request. Nothing to install, no files to download.', + howItWorks: 'How it works', + step1Title: 'Open', + step1Text: 'From the badge in a README, by typing the repository, or from your list of resources.', + step2Title: 'Edit', + step2Text: 'In the official eXeLearning editor, as usual.', + step3Title: 'Save to GitHub', + step3Text: 'A commit on the branch or a pull request. Ctrl/Cmd+S works too.', + footerNote: 'Works with the official eXeLearning editor.', + badgeLabel: 'Edit in', + badgeAlt: 'Edit in eXeLearning', repoLabel: 'GitHub repository', seeAll: 'See all your resources', seeAllHint: 'Sign in and you will see the eXeLearning resources in your repositories, with their screenshot, ready to edit.', - orOpen: 'or open one directly', + orOpen: 'Or open one directly', publicHint: 'Public repositories open without signing in; you will be asked to sign in to save.', otherRepo: 'Is the resource in another repository?', signedInAs: '{summary} · signed in as {login}', @@ -35,7 +46,7 @@ const en = { asPullRequest: 'Create a branch for this change and start a pull request', toBranch: 'Commit directly to the {branch} branch', protectedNote: '{branch} is protected: the change will be proposed as a pull request.', - experimental: 'Experimental feature', + experimental: 'Experimental', source: 'Source code', yourRepos: 'Your eXeLearning resources', summary: '{n} resource(s) in {r} repositories', @@ -77,11 +88,22 @@ const en = { }; const es: typeof en = { - tagline: 'Edita recursos de eXeLearning guardados en GitHub y guárdalos de nuevo en el repositorio.', + headline: 'Edita en el navegador los recursos de eXeLearning guardados en GitHub', + tagline: 'Abre un proyecto de eXeLearning de cualquier repositorio en el editor oficial y guarda los cambios de vuelta como un commit o una pull request. Sin instalar nada ni descargar ficheros.', + howItWorks: 'Cómo funciona', + step1Title: 'Abre', + step1Text: 'Desde el badge de un README, escribiendo el repositorio o desde tu lista de recursos.', + step2Title: 'Edita', + step2Text: 'En el editor oficial de eXeLearning, como siempre.', + step3Title: 'Guarda en GitHub', + step3Text: 'Un commit en la rama o una pull request. Ctrl/Cmd+S también vale.', + footerNote: 'Funciona con el editor oficial de eXeLearning.', + badgeLabel: 'Editar en', + badgeAlt: 'Editar en eXeLearning', repoLabel: 'Repositorio de GitHub', seeAll: 'Ver todos tus recursos', seeAllHint: 'Inicia sesión y verás los recursos de eXeLearning de tus repositorios, con su captura, listos para editar.', - orOpen: 'o abre uno directamente', + orOpen: 'O abre uno directamente', publicHint: 'Los repositorios públicos se abren sin iniciar sesión; para guardar te la pediremos.', otherRepo: '¿El recurso está en otro repositorio?', signedInAs: '{summary} · conectado como {login}', @@ -112,7 +134,7 @@ const es: typeof en = { asPullRequest: 'Crear una rama para este cambio y proponer una pull request', toBranch: 'Guardar directamente en la rama {branch}', protectedNote: '{branch} está protegida: el cambio se propondrá como pull request.', - experimental: 'Funcionalidad experimental', + experimental: 'Experimental', source: 'Código fuente', yourRepos: 'Tus recursos de eXeLearning', summary: '{n} recurso(s) en {r} repositorios', @@ -153,8 +175,365 @@ const es: typeof en = { notConfigured: 'Guardar en GitHub no está configurado en este servidor.', }; -const strings = navigator.language.toLowerCase().startsWith('es') ? es : en; -export const lang = strings === es ? 'es' : 'en'; +const ca: typeof en = { + headline: 'Edita al navegador els recursos d\'eXeLearning desats a GitHub', + tagline: 'Obre un projecte d\'eXeLearning de qualsevol repositori a l\'editor oficial i desa els canvis de tornada com un commit o una pull request. Sense instal·lar res ni baixar fitxers.', + howItWorks: 'Com funciona', + step1Title: 'Obre', + step1Text: 'Des del badge d\'un README, escrivint el repositori o des de la teva llista de recursos.', + step2Title: 'Edita', + step2Text: 'A l\'editor oficial d\'eXeLearning, com sempre.', + step3Title: 'Desa a GitHub', + step3Text: 'Un commit a la branca o una pull request. Ctrl/Cmd+S també funciona.', + footerNote: 'Funciona amb l\'editor oficial d\'eXeLearning.', + badgeLabel: 'Editar a', + badgeAlt: 'Editar a eXeLearning', + repoLabel: 'Repositori de GitHub', + seeAll: 'Mostra tots els teus recursos', + seeAllHint: 'Inicia la sessió i veuràs els recursos d\'eXeLearning dels teus repositoris, amb la seva captura, a punt per editar.', + orOpen: 'O obre\'n un directament', + publicHint: 'Els repositoris públics s\'obren sense iniciar la sessió; per desar, te la demanarem.', + otherRepo: 'El recurs és en un altre repositori?', + signedInAs: '{summary} · connectat com a {login}', + open: 'Obre', + opening: 'S\'està obrint {repo}…', + loadingEditor: 'S\'està carregant l\'editor…', + save: 'Desa a GitHub', + saving: 'S\'està desant…', + saved: 'Desat', + unsaved: 'Canvis sense desar', + noChanges: 'No hi ha canvis per desar', + download: 'Baixa el .elpx', + copyBadge: 'Copia el badge per al README', + badgeCopied: 'Badge copiat: enganxa\'l al teu README.', + openOther: 'Obre un altre repositori', + logout: 'Tanca la sessió de GitHub', + commitMessage: 'Missatge del commit', + defaultMessage: 'Actualitza el recurs d\'eXeLearning', + filesToSave: 'Fitxers que es desen', + deleteRemoved: 'Esborra també {n} fitxer(s) que el recurs ja no fa servir', + writeSite: 'Desa també el web exportat ({n} fitxer(s) canviat(s): index.html, html/…)', + siteHelpTitle: 'Web exportat o workflow de Pages?', + siteHelpCommitTitle: 'Desar el web exportat:', + siteHelpCommit: 'index.html, html/ i libs/ es desen al repositori en el mateix commit. El web està al dia tan bon punt deses, el serveixis des d\'on el serveixis (Pages des d\'una branca, un altre servidor, una baixada), però cada desament canvia molts fitxers i l\'historial s\'omple de soroll.', + siteHelpActionTitle: 'Workflow de Pages (⋯ → Publica a GitHub Pages):', + siteHelpAction: 'el repositori només desa la font i GitHub regenera el web amb l\'exportació oficial d\'eXeLearning i el publica un o dos minuts després de cada desament. Historial net, però cal configurar-lo una vegada per repositori i només publica a GitHub Pages.', + siteHelpTip: 'Fes servir l\'un o l\'altre: amb el workflow, deixa aquesta opció sense marcar.', + asPullRequest: 'Crea una branca per a aquest canvi i proposa una pull request', + toBranch: 'Desa directament a la branca {branch}', + protectedNote: '{branch} està protegida: el canvi es proposarà com a pull request.', + experimental: 'Experimental', + source: 'Codi font', + yourRepos: 'Els teus recursos d\'eXeLearning', + summary: '{n} recurs(os) en {r} repositoris', + searchingMore: 'S\'estan cercant recursos en {n} repositoris més…', + edit: 'Edita', + noScreenshot: 'Sense captura de pantalla', + otherRepos: 'Repositoris sense recursos d\'eXeLearning ({n})', + gridView: 'Quadrícula', + listView: 'Llista', + searching: 'cercant recursos…', + noResource: 'sense recurs d\'eXeLearning', + root: 'arrel', + private: 'privat', + moreAccess: 'Dona accés a eXeLearning a més repositoris', + noRepos: 'L\'app eXeLearning encara no té accés a cap repositori.', + publishPages: 'Publica a GitHub Pages…', + viewSite: 'Mostra el web', + pagesTitle: 'Publica a GitHub Pages', + pagesIntro: 'GitHub pot regenerar i publicar el web cada vegada que desis. Fes aquests dos passos una vegada en aquest repositori:', + pagesWorkflow: 'Afegeix el flux de publicació (GitHub l\'obre ja preparat: prem "Commit changes")', + pagesSettings: 'A Settings → Pages, tria Source: "GitHub Actions"', + pagesResult: 'El web serà a {url}', + close: 'Tanca', + cancel: 'Cancel·la', + committed: 'Desat a {branch}.', + pullRequest: 'Pull request oberta.', + view: 'Mostra a GitHub', + loginNeeded: 'Inicia la sessió amb GitHub per continuar.', + installNeeded: 'Dona accés a l\'app eXeLearning a {repo} a la finestra de GitHub.', + noAccess: 'L\'app eXeLearning no pot escriure a {repo}. Instal·la-la allà o baixa el .elpx.', + noProject: 'No hi ha cap projecte d\'eXeLearning (content.xml) a {repo}{path}.', + pickFolder: 'Projectes trobats en aquest repositori:', + rateLimited: 'GitHub limita l\'ús anònim. Inicia la sessió amb GitHub per continuar.', + notFound: 'No s\'ha trobat el repositori. Si és privat, inicia la sessió amb GitHub.', + signIn: 'Inicia la sessió amb GitHub', + leaveWarning: 'Hi ha canvis sense desar.', + error: 'Error: {message}', + notConfigured: 'Desar a GitHub no està configurat en aquest servidor.', +}; + +const eu: typeof en = { + headline: 'Editatu nabigatzailean GitHub-en gordetako eXeLearning baliabideak', + tagline: 'Ireki edozein biltegitako eXeLearning proiektu bat editore ofizialean eta gorde aldaketak commit edo pull request gisa. Ezer instalatu edo fitxategirik deskargatu gabe.', + howItWorks: 'Nola funtzionatzen du', + step1Title: 'Ireki', + step1Text: 'README bateko badgetik, biltegiaren izena idatzita edo zure baliabideen zerrendatik.', + step2Title: 'Editatu', + step2Text: 'eXeLearning editore ofizialean, beti bezala.', + step3Title: 'Gorde GitHub-en', + step3Text: 'Commit bat adarrean edo pull request bat. Ctrl/Cmd+S ere badabil.', + footerNote: 'eXeLearning editore ofizialarekin dabil.', + badgeLabel: 'Editatu hemen:', + badgeAlt: 'Editatu eXeLearning-en', + repoLabel: 'GitHub biltegia', + seeAll: 'Ikusi zure baliabide guztiak', + seeAllHint: 'Hasi saioa eta zure biltegietako eXeLearning baliabideak ikusiko dituzu, pantaila-argazkiarekin, editatzeko prest.', + orOpen: 'Edo ireki bat zuzenean', + publicHint: 'Biltegi publikoak saioa hasi gabe irekitzen dira; gordetzeko, saioa hasteko eskatuko dizugu.', + otherRepo: 'Baliabidea beste biltegi batean dago?', + signedInAs: '{summary} · {login} gisa konektatuta', + open: 'Ireki', + opening: '{repo} irekitzen…', + loadingEditor: 'Editorea kargatzen…', + save: 'Gorde GitHub-en', + saving: 'Gordetzen…', + saved: 'Gordeta', + unsaved: 'Gorde gabeko aldaketak', + noChanges: 'Ez dago gordetzeko aldaketarik', + download: 'Deskargatu .elpx', + copyBadge: 'Kopiatu READMErako badgea', + badgeCopied: 'Badgea kopiatuta: itsatsi zure READMEan.', + openOther: 'Ireki beste biltegi bat', + logout: 'Itxi GitHub saioa', + commitMessage: 'Commitaren mezua', + defaultMessage: 'Eguneratu eXeLearning baliabidea', + filesToSave: 'Gordeko diren fitxategiak', + deleteRemoved: 'Ezabatu baliabideak jada erabiltzen ez dituen {n} fitxategi ere', + writeSite: 'Gorde esportatutako webgunea ere ({n} fitxategi aldatuta: index.html, html/…)', + siteHelpTitle: 'Esportatutako webgunea edo Pages workflowa?', + siteHelpCommitTitle: 'Gorde esportatutako webgunea:', + siteHelpCommit: 'index.html, html/ eta libs/ biltegian gordetzen dira commit berean. Webgunea eguneratuta dago gordetzen duzun unetik, edonondik zerbitzatzen duzula ere (adar bateko Pages, beste zerbitzari bat, deskarga bat), baina gordetze bakoitzak fitxategi asko aldatzen ditu eta historia zarataz betetzen da.', + siteHelpActionTitle: 'Pages workflowa (⋯ → Argitaratu GitHub Pages-en):', + siteHelpAction: 'biltegiak iturburua bakarrik gordetzen du, eta GitHub-ek webgunea berriro sortzen du eXeLearning-en esportazio ofizialarekin eta gordetze bakoitzaren ondoren minutu bat edo bitan argitaratzen du. Historia garbia, baina biltegi bakoitzean behin konfiguratu behar da eta GitHub Pages-en bakarrik argitaratzen du.', + siteHelpTip: 'Erabili bata edo bestea: workflowarekin, utzi aukera hau markatu gabe.', + asPullRequest: 'Sortu adar bat aldaketa honetarako eta proposatu pull request bat', + toBranch: 'Gorde zuzenean {branch} adarrean', + protectedNote: '{branch} babestuta dago: aldaketa pull request gisa proposatuko da.', + experimental: 'Esperimentala', + source: 'Iturburu-kodea', + yourRepos: 'Zure eXeLearning baliabideak', + summary: '{n} baliabide {r} biltegitan', + searchingMore: 'Baliabideak bilatzen beste {n} biltegitan…', + edit: 'Editatu', + noScreenshot: 'Pantaila-argazkirik ez', + otherRepos: 'eXeLearning baliabiderik gabeko biltegiak ({n})', + gridView: 'Sareta', + listView: 'Zerrenda', + searching: 'baliabideak bilatzen…', + noResource: 'eXeLearning baliabiderik ez', + root: 'erroa', + private: 'pribatua', + moreAccess: 'Eman eXeLearning-i biltegi gehiagotarako sarbidea', + noRepos: 'eXeLearning aplikazioak ez du oraindik inongo biltegitarako sarbiderik.', + publishPages: 'Argitaratu GitHub Pages-en…', + viewSite: 'Ikusi webgunea', + pagesTitle: 'Argitaratu GitHub Pages-en', + pagesIntro: 'GitHub-ek webgunea berriro sortu eta argitaratu dezake gordetzen duzun bakoitzean. Egin bi urrats hauek behin biltegi honetan:', + pagesWorkflow: 'Gehitu argitalpen-workflowa (GitHub-ek prest irekitzen du: sakatu "Commit changes")', + pagesSettings: 'Settings → Pages atalean, aukeratu Source: "GitHub Actions"', + pagesResult: 'Webgunea hemen egongo da: {url}', + close: 'Itxi', + cancel: 'Utzi', + committed: '{branch} adarrean gordeta.', + pullRequest: 'Pull requesta irekita.', + view: 'Ikusi GitHub-en', + loginNeeded: 'Hasi saioa GitHub-ekin jarraitzeko.', + installNeeded: 'Eman eXeLearning aplikazioari {repo} biltegirako sarbidea GitHub-en leihoan.', + noAccess: 'eXeLearning aplikazioak ezin du {repo} biltegian idatzi. Instalatu bertan, edo deskargatu .elpx.', + noProject: 'Ez dago eXeLearning proiekturik (content.xml) hemen: {repo}{path}.', + pickFolder: 'Biltegi honetan aurkitutako proiektuak:', + rateLimited: 'GitHub-ek erabilera anonimoa mugatzen du. Hasi saioa GitHub-ekin jarraitzeko.', + notFound: 'Ez da biltegia aurkitu. Pribatua bada, hasi saioa GitHub-ekin.', + signIn: 'Hasi saioa GitHub-ekin', + leaveWarning: 'Gorde gabeko aldaketak daude.', + error: 'Errorea: {message}', + notConfigured: 'GitHub-en gordetzea ez dago konfiguratuta zerbitzari honetan.', +}; + +const gl: typeof en = { + headline: 'Edita no navegador os recursos de eXeLearning gardados en GitHub', + tagline: 'Abre un proxecto de eXeLearning de calquera repositorio no editor oficial e garda os cambios de volta como un commit ou unha pull request. Sen instalar nada nin descargar ficheiros.', + howItWorks: 'Como funciona', + step1Title: 'Abre', + step1Text: 'Desde o badge dun README, escribindo o repositorio ou desde a túa lista de recursos.', + step2Title: 'Edita', + step2Text: 'No editor oficial de eXeLearning, coma sempre.', + step3Title: 'Garda en GitHub', + step3Text: 'Un commit na rama ou unha pull request. Ctrl/Cmd+S tamén vale.', + footerNote: 'Funciona co editor oficial de eXeLearning.', + badgeLabel: 'Editar en', + badgeAlt: 'Editar en eXeLearning', + repoLabel: 'Repositorio de GitHub', + seeAll: 'Ver todos os teus recursos', + seeAllHint: 'Inicia sesión e verás os recursos de eXeLearning dos teus repositorios, coa súa captura, listos para editar.', + orOpen: 'Ou abre un directamente', + publicHint: 'Os repositorios públicos ábrense sen iniciar sesión; para gardar pedirémosche que a inicies.', + otherRepo: 'O recurso está noutro repositorio?', + signedInAs: '{summary} · conectado como {login}', + open: 'Abrir', + opening: 'Abrindo {repo}…', + loadingEditor: 'Cargando o editor…', + save: 'Gardar en GitHub', + saving: 'Gardando…', + saved: 'Gardado', + unsaved: 'Cambios sen gardar', + noChanges: 'Non hai cambios que gardar', + download: 'Descargar .elpx', + copyBadge: 'Copiar badge para o README', + badgeCopied: 'Badge copiado: pégao no teu README.', + openOther: 'Abrir outro repositorio', + logout: 'Pechar sesión de GitHub', + commitMessage: 'Mensaxe do commit', + defaultMessage: 'Actualiza o recurso de eXeLearning', + filesToSave: 'Ficheiros que se gardan', + deleteRemoved: 'Borrar tamén {n} ficheiro(s) que o recurso xa non usa', + writeSite: 'Gardar tamén a web exportada ({n} ficheiro(s) cambiado(s): index.html, html/…)', + siteHelpTitle: 'Web exportada ou workflow de Pages?', + siteHelpCommitTitle: 'Gardar a web exportada:', + siteHelpCommit: 'index.html, html/ e libs/ gárdanse no repositorio no mesmo commit. A web está ao día en canto gardas, sexa cal sexa o sitio desde onde a sirvas (Pages desde unha rama, outro servidor, unha descarga), pero cada gardado cambia moitos ficheiros e o historial énchese de ruído.', + siteHelpActionTitle: 'Workflow de Pages (⋯ → Publicar en GitHub Pages):', + siteHelpAction: 'o repositorio garda só a fonte e GitHub rexenera a web coa exportación oficial de eXeLearning e publícaa un ou dous minutos despois de cada gardado. Historial limpo, pero hai que configuralo unha vez por repositorio e só publica en GitHub Pages.', + siteHelpTip: 'Usa un ou outro: co workflow, deixa esta opción sen marcar.', + asPullRequest: 'Crear unha rama para este cambio e propor unha pull request', + toBranch: 'Gardar directamente na rama {branch}', + protectedNote: '{branch} está protexida: o cambio proporase como pull request.', + experimental: 'Experimental', + source: 'Código fonte', + yourRepos: 'Os teus recursos de eXeLearning', + summary: '{n} recurso(s) en {r} repositorios', + searchingMore: 'Buscando recursos en {n} repositorios máis…', + edit: 'Editar', + noScreenshot: 'Sen captura de pantalla', + otherRepos: 'Repositorios sen recursos de eXeLearning ({n})', + gridView: 'Grade', + listView: 'Lista', + searching: 'buscando recursos…', + noResource: 'sen recurso de eXeLearning', + root: 'raíz', + private: 'privado', + moreAccess: 'Dar acceso a eXeLearning a máis repositorios', + noRepos: 'A app eXeLearning aínda non ten acceso a ningún repositorio.', + publishPages: 'Publicar en GitHub Pages…', + viewSite: 'Ver web', + pagesTitle: 'Publicar en GitHub Pages', + pagesIntro: 'GitHub pode rexenerar e publicar a web cada vez que gardes. Fai estes dous pasos unha vez neste repositorio:', + pagesWorkflow: 'Engadir o fluxo de publicación (GitHub ábreo xa preparado: preme "Commit changes")', + pagesSettings: 'En Settings → Pages, escolle Source: "GitHub Actions"', + pagesResult: 'A web estará en {url}', + close: 'Pechar', + cancel: 'Cancelar', + committed: 'Gardado en {branch}.', + pullRequest: 'Pull request aberta.', + view: 'Ver en GitHub', + loginNeeded: 'Inicia sesión con GitHub para continuar.', + installNeeded: 'Dálle acceso á app eXeLearning a {repo} na xanela de GitHub.', + noAccess: 'A app eXeLearning non pode escribir en {repo}. Instálaa alí ou descarga o .elpx.', + noProject: 'Non hai un proxecto de eXeLearning (content.xml) en {repo}{path}.', + pickFolder: 'Proxectos atopados neste repositorio:', + rateLimited: 'GitHub limita o uso anónimo. Inicia sesión con GitHub para continuar.', + notFound: 'Non se atopa o repositorio. Se é privado, inicia sesión con GitHub.', + signIn: 'Iniciar sesión con GitHub', + leaveWarning: 'Hai cambios sen gardar.', + error: 'Erro: {message}', + notConfigured: 'Gardar en GitHub non está configurado neste servidor.', +}; + +const de: typeof en = { + headline: 'Auf GitHub gespeicherte eXeLearning-Inhalte direkt im Browser bearbeiten', + tagline: 'Öffne ein eXeLearning-Projekt aus einem beliebigen Repository im offiziellen Editor und speichere deine Änderungen als Commit oder Pull Request zurück. Nichts zu installieren, keine Dateien herunterzuladen.', + howItWorks: 'So funktioniert es', + step1Title: 'Öffnen', + step1Text: 'Über das Badge in einer README, durch Eingabe des Repositorys oder aus deiner Liste der Inhalte.', + step2Title: 'Bearbeiten', + step2Text: 'Im offiziellen eXeLearning-Editor, wie gewohnt.', + step3Title: 'Auf GitHub speichern', + step3Text: 'Ein Commit im Branch oder ein Pull Request. Ctrl/Cmd+S geht auch.', + footerNote: 'Funktioniert mit dem offiziellen eXeLearning-Editor.', + badgeLabel: 'Bearbeiten in', + badgeAlt: 'In eXeLearning bearbeiten', + repoLabel: 'GitHub-Repository', + seeAll: 'Alle deine Inhalte anzeigen', + seeAllHint: 'Melde dich an, dann siehst du die eXeLearning-Inhalte in deinen Repositorys mit Vorschaubild, bereit zum Bearbeiten.', + orOpen: 'Oder öffne einen direkt', + publicHint: 'Öffentliche Repositorys öffnen sich ohne Anmeldung; zum Speichern bitten wir dich, dich anzumelden.', + otherRepo: 'Liegt der Inhalt in einem anderen Repository?', + signedInAs: '{summary} · angemeldet als {login}', + open: 'Öffnen', + opening: '{repo} wird geöffnet…', + loadingEditor: 'Editor wird geladen…', + save: 'Auf GitHub speichern', + saving: 'Wird gespeichert…', + saved: 'Gespeichert', + unsaved: 'Ungespeicherte Änderungen', + noChanges: 'Keine Änderungen zu speichern', + download: '.elpx herunterladen', + copyBadge: 'README-Badge kopieren', + badgeCopied: 'Badge kopiert: Füge es in deine README ein.', + openOther: 'Anderes Repository öffnen', + logout: 'Von GitHub abmelden', + commitMessage: 'Commit-Nachricht', + defaultMessage: 'eXeLearning-Inhalt aktualisieren', + filesToSave: 'Zu speichernde Dateien', + deleteRemoved: 'Auch {n} Datei(en) löschen, die der Inhalt nicht mehr verwendet', + writeSite: 'Auch die exportierte Website speichern ({n} geänderte Datei(en): index.html, html/…)', + siteHelpTitle: 'Exportierte Website oder Pages-Workflow?', + siteHelpCommitTitle: 'Exportierte Website speichern:', + siteHelpCommit: 'index.html, html/ und libs/ kommen im selben Commit ins Repository. Die Website ist sofort nach dem Speichern aktuell, egal von wo sie ausgeliefert wird (Pages aus einem Branch, ein anderer Server, ein Download), aber jedes Speichern ändert viele Dateien und die Historie wird unübersichtlich.', + siteHelpActionTitle: 'Pages-Workflow (⋯ → Auf GitHub Pages veröffentlichen):', + siteHelpAction: 'Das Repository enthält nur die Quelle, und GitHub baut die Website mit dem offiziellen eXeLearning-Export neu und veröffentlicht sie ein bis zwei Minuten nach jedem Speichern. Saubere Historie, aber er muss einmal pro Repository eingerichtet werden und veröffentlicht nur auf GitHub Pages.', + siteHelpTip: 'Nutze nur eins von beiden: Mit dem Workflow lässt du diese Option deaktiviert.', + asPullRequest: 'Einen Branch für diese Änderung erstellen und einen Pull Request starten', + toBranch: 'Direkt in den Branch {branch} committen', + protectedNote: '{branch} ist geschützt: Die Änderung wird als Pull Request vorgeschlagen.', + experimental: 'Experimentell', + source: 'Quellcode', + yourRepos: 'Deine eXeLearning-Inhalte', + summary: '{n} Inhalt(e) in {r} Repositorys', + searchingMore: 'Suche nach Inhalten in {n} weiteren Repositorys…', + edit: 'Bearbeiten', + noScreenshot: 'Kein Vorschaubild', + otherRepos: 'Repositorys ohne eXeLearning-Inhalte ({n})', + gridView: 'Raster', + listView: 'Liste', + searching: 'suche nach Inhalten…', + noResource: 'kein eXeLearning-Inhalt', + root: 'Hauptverzeichnis', + private: 'privat', + moreAccess: 'eXeLearning Zugriff auf weitere Repositorys geben', + noRepos: 'Die eXeLearning-App hat noch auf kein Repository Zugriff.', + publishPages: 'Auf GitHub Pages veröffentlichen…', + viewSite: 'Website ansehen', + pagesTitle: 'Auf GitHub Pages veröffentlichen', + pagesIntro: 'GitHub kann die Website bei jedem Speichern neu bauen und veröffentlichen. Führe diese zwei Schritte einmal in diesem Repository aus:', + pagesWorkflow: 'Den Veröffentlichungs-Workflow hinzufügen (GitHub öffnet ihn fertig vorbereitet: Klicke auf "Commit changes")', + pagesSettings: 'Wähle unter Settings → Pages die Option Source: "GitHub Actions"', + pagesResult: 'Die Website ist dann unter {url} erreichbar', + close: 'Schließen', + cancel: 'Abbrechen', + committed: 'In {branch} gespeichert.', + pullRequest: 'Pull Request geöffnet.', + view: 'Auf GitHub ansehen', + loginNeeded: 'Melde dich mit GitHub an, um fortzufahren.', + installNeeded: 'Gib der eXeLearning-App im GitHub-Fenster Zugriff auf {repo}.', + noAccess: 'Die eXeLearning-App kann nicht in {repo} schreiben. Installiere sie dort oder lade die .elpx herunter.', + noProject: 'Kein eXeLearning-Projekt (content.xml) in {repo}{path}.', + pickFolder: 'In diesem Repository gefundene Projekte:', + rateLimited: 'GitHub begrenzt die anonyme Nutzung. Melde dich mit GitHub an, um fortzufahren.', + notFound: 'Repository nicht gefunden. Wenn es privat ist, melde dich mit GitHub an.', + signIn: 'Mit GitHub anmelden', + leaveWarning: 'Es gibt ungespeicherte Änderungen.', + error: 'Fehler: {message}', + notConfigured: 'Das Speichern auf GitHub ist auf diesem Server nicht konfiguriert.', +}; + +// The same languages as the editor; English when the browser asks for none of them. +const languages = { en, es, ca, eu, gl, de }; +type Lang = keyof typeof languages; +export const lang: Lang = (navigator.languages ?? [navigator.language]) + .map((tag) => tag.toLowerCase().split('-')[0]) + .find((code): code is Lang => code in languages) ?? 'en'; +const strings = languages[lang]; export function t(key: keyof typeof en, vars: Record = {}): string { return strings[key].replace(/\{(\w+)\}/g, (_, name) => String(vars[name] ?? '')); diff --git a/src/app/main.ts b/src/app/main.ts index bc89983..a3b8cb1 100644 --- a/src/app/main.ts +++ b/src/app/main.ts @@ -372,7 +372,7 @@ async function showRepos() { form.classList.toggle('compact', !!token); $('repo-label').textContent = token ? t('otherRepo') : t('repoLabel'); if (token) $('repos-box').insertBefore(form, $('repos-box').querySelector('.links')); - else $('divider').after(form); + else $('choices').append(form); if (!token) return; const api = createApi(token); const login = await api<{ login: string }>('/user').then((u) => u.login, () => ''); @@ -449,8 +449,8 @@ async function download() { async function copyBadge() { if (!project) return; const url = `${location.origin}/${query(project.target, project.branch === 'main' ? undefined : project.branch)}`; - const label = lang === 'es' ? 'Editar%20en' : 'Edit%20in'; - const alt = lang === 'es' ? 'Editar en eXeLearning' : 'Edit in eXeLearning'; + const label = encodeURIComponent(t('badgeLabel')); + const alt = t('badgeAlt'); await navigator.clipboard.writeText(`[![${alt}](https://img.shields.io/badge/${label}-eXeLearning-26ddc7?labelColor=1f2937)](${url})`); toast(t('badgeCopied')); } @@ -458,7 +458,7 @@ async function copyBadge() { async function main() { document.documentElement.lang = lang; const texts: Record[0]> = { - tagline: 'tagline', 'repo-label': 'repoLabel', 'open-button': 'open', 'save-label': 'save', download: 'download', badge: 'copyBadge', + headline: 'headline', tagline: 'tagline', 'how-title': 'howItWorks', 'step1-title': 'step1Title', 'step1-text': 'step1Text', 'step2-title': 'step2Title', 'step2-text': 'step2Text', 'step3-title': 'step3Title', 'step3-text': 'step3Text', 'footer-note': 'footerNote', 'how-link': 'howItWorks', 'repo-label': 'repoLabel', 'open-button': 'open', 'save-label': 'save', download: 'download', badge: 'copyBadge', other: 'openOther', logout: 'logout', 'message-label': 'commitMessage', 'files-label': 'filesToSave', 'pr-label': 'asPullRequest', 'cancel-save': 'cancel', 'confirm-save': 'save', 'signin-label': 'signIn', 'see-all': 'seeAll', 'see-all-hint': 'seeAllHint', 'or-open': 'orOpen', 'open-hint': 'publicHint', experimental: 'experimental', 'source-label': 'source', 'repos-title': 'yourRepos', 'more-access': 'moreAccess', 'view-grid-label': 'gridView', 'view-list-label': 'listView', 'logout-landing': 'logout', pages: 'publishPages', 'pages-title': 'pagesTitle',