Skip to content

feat(i18n): integrate Spanish translations into Learn login page #1229

Open

Description

@KanishJebaMathewM

Context

GSoC 2027 Idea #7, One Learn, Many Languages, now has a client-side translation foundation proposed in #1226 and implemented by PR #1227.

This issue adds the first isolated Learn page integration: Spanish translations for the login and registration page using the existing i18n helper. It is a follow-up integration, not a replacement for #1226 or PR #1227.

Dependencies

Implementation must wait until both dependencies have merged into main:

  • PR #1227 — client-side i18n helper and English catalog
  • PR #1215 — Google sign-in changes to learn/public/login.html

Do not modify either contributor’s branch or stack a pull request on either unmerged branch. Start from a fresh main after both merges.

Problem

The Learn login/register page is currently English-only and does not use the client-side i18n foundation.

The existing helper supports language detection through:

  1. localStorage.lang
  2. Browser-language detection
  3. English fallback

There is currently no user-facing language selector. This issue must not introduce one.

When the existing mechanism selects es, the login page should render Spanish strings from public/locales/es.json.

Scope

In scope

  • learn/public/login.html
  • learn/public/locales/en.json
  • learn/public/locales/es.json
  • Narrowly scoped integration tests or deterministic static contract tests

Use the existing learn/public/js/i18n.js helper from PR #1227. Do not modify or reimplement the helper.

Translation coverage

Add stable login.* keys for the login/register UI strings owned by the page:

  • Login and registration headings
  • Labels
  • Input placeholders
  • Login and registration buttons
  • Static descriptions and notices
  • Accessible labels
  • Relevant page-owned tooltips
  • Page-owned validation messages
  • Loading and status messages generated by the page
  • Resend-verification messages and controls
  • Registration success-message headings and static text
  • Terms and privacy link labels
  • Navigation text belonging to the login page

Keep English text inline in the HTML as the fallback.

The HTML <title> and meta description are outside this issue because the current helper does not translate template metadata. They should remain unchanged unless a safe, isolated solution is possible without modifying i18n.js.

Password validation boundary

learn/public/js/password-rules.js is shared by:

  • login.html
  • profile.html
  • reset-password.html

Do not modify password-rules.js or globally translate its checklist labels and validation messages as part of this issue.

The existing password validation rules, checklist behavior, and returned validation semantics must remain unchanged. If login-page-specific translation of a returned validation message is implemented, it must be narrowly scoped to login.html, use stable local keys, and not alter the shared helper or other pages.

Server-provided messages

Do not blindly translate arbitrary API-provided data.error or data.message values.

Server-provided messages must remain text content. Do not introduce:

  • Backend changes
  • New server error-code mappings
  • Translation of arbitrary server-controlled strings
  • Changes to API response semantics

Only static client-owned fallback messages may use catalog keys.

Icons and interactive elements

Because i18n.apply() uses textContent, translation attributes must target text-only elements where necessary.

Do not place data-i18n on an element whose child icons, controls, or interactive elements would be removed by textContent.

Preserve:

  • Icons
  • Password visibility controls
  • Buttons
  • Links
  • Form controls
  • Existing accessible structure

Dynamic success messages

The registration success view must preserve its existing sign-in interaction.

Do not inject translated catalog content through innerHTML. Build translated text and interactive controls with safe DOM construction and textContent/setAttribute as appropriate.

Do not introduce new unsafe HTML interpolation.

Required behavior

When localStorage.lang is "es" or browser-language detection selects Spanish:

  • The Spanish catalog loads through the existing helper.
  • Tagged login/register UI text renders in Spanish.
  • <html lang> reflects es after the Spanish catalog loads successfully.
  • Missing Spanish keys fall back to English.
  • A failed Spanish catalog request leaves the page usable in English.

When the language is unsupported or no usable catalog is available:

  • The page remains usable.
  • English inline text and English catalog fallbacks are preserved.
  • No authentication behavior changes.

Authentication compatibility

The implementation must preserve all existing behavior, including:

  • Login and registration API endpoints
  • Request payload names and values
  • Password input types and autocomplete behavior
  • Token storage in localStorage.edu_token
  • User storage in localStorage.edu_user
  • Redirect validation
  • Post-login redirect behavior
  • Email-verification and resend flow
  • Button loading and disabled states
  • Client-side validation semantics
  • API error handling
  • Google sign-in behavior introduced by PR feat: add Google sign-in #1215

No authentication, storage, redirect, or backend changes are in scope.

Acceptance criteria

  • Implementation starts from a fresh main after PR feat(i18n): add client-side i18n helper and English catalog #1227 and PR feat: add Google sign-in #1215 are merged.
  • login.html loads the existing i18n helper using the project’s existing script-loading conventions.
  • en.json contains stable login.* keys for all agreed in-scope client-owned strings.
  • es.json contains Spanish translations for the same agreed in-scope keys.
  • Both locale files are valid JSON.
  • All translated elements retain English inline fallbacks.
  • Spanish renders when localStorage.lang = "es" or browser-language detection selects Spanish.
  • No language selector is introduced.
  • Unsupported languages fall back to English.
  • Missing or failed catalogs do not break the page.
  • <html lang> behavior follows the existing helper contract.
  • Icons and interactive child elements are preserved.
  • Dynamic registration success content uses safe DOM construction and preserves the sign-in action.
  • Arbitrary server-provided errors and messages remain text and are not blindly translated.
  • Shared password-rules.js is not modified.
  • Login, registration, Google sign-in, verification, redirects, storage, validation, and loading behavior remain unchanged.
  • No backend files, API contracts, routing behavior, or shared navigation are modified.

Testing expectations

Add a focused deterministic test or static contract test that verifies:

  • Both locale files are valid JSON.
  • Every in-scope login.* key required by the page exists in en.json.
  • Spanish entries exist for the required keys.
  • login.html includes the i18n helper.
  • Required translation attributes are present.
  • English inline fallbacks remain present.
  • Translation attributes are not applied to icon-bearing or interactive parent elements.
  • The implementation does not add unsafe translated innerHTML usage.
  • The expected fallback behavior is represented by the catalog/key contract.

Do not introduce a large browser-testing framework for this issue.

Run:

  • The focused integration/static-contract test
  • Relevant existing Learn authentication tests
  • JSON validation
  • git diff --check
  • node --check for any modified JavaScript

Manual browser verification must cover:

  • English with no saved language
  • Spanish using localStorage.lang = "es"
  • Spanish selected through browser-language detection
  • Unsupported-language fallback
  • Failed Spanish catalog loading
  • Login interaction
  • Registration interaction
  • Email-verification resend flow
  • Google sign-in behavior when configured
  • Password visibility controls
  • Registration success view and sign-in action

Relevant files

Explicit exclusions

  • Implementing or modifying i18n.js
  • Adding a language selector
  • Translating the HTML title or meta description
  • Modifying password-rules.js
  • Translating arbitrary server-provided messages
  • Adding backend error-code mappings
  • Changing authentication APIs or payloads
  • Changing token storage or redirect behavior
  • Translating shared navbar/footer content
  • Translating other Learn pages
  • Changing language-prefixed routing
  • Pluralization
  • RTL layout
  • Activity, material, quiz, or question translations
  • AI-assisted translation generation
  • Human translation approval workflows
  • Offline-first functionality

Activity

  1. added
    good first issue
    2026-11
    on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    2026-11good first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions