etherpad-lite/src
John McLear a1bb958b18
fix(pad): stop hardcoding lang='en', let the client auto-detect locale (#7586) (#7588)
`Pad.normalizePadSettings()` was defaulting `lang` to the literal string
'en' when `rawPadSettings.lang` was not a string. That value flowed into
`clientVars.padOptions.lang` and then into `getParams()` in pad.ts,
which calls `html10n.localize([serverValue, 'en'])` as a callback for
the `lang` setting. The result: every pad forced English on load,
overriding the browser's Accept-Language and the existing auto-detect
chain in l10n.ts (cookie -> navigator.language -> 'en').

The regression was introduced in #7545 ("Add creator-owned pad settings
defaults", commit e0ccdb4d9). 2.6.1 did not have this default, so
auto-detect worked there. 2.7.0 broke it.

Fix: default `lang` to null. The client's existing flow already handles
null correctly — getParams() at pad.ts:172 has
`if (serverValue == null) continue;`, so the forced-localize callback
simply does not fire, and l10n.ts's browser-language auto-detect runs.
Pad-settings dropdown consumer at pad.ts:489 already uses
`padOptions.lang || 'en'` so null renders fine there too.

`PadSettings.lang` is now typed `string | null` to match.

Added three backend regression tests under `normalizePadSettings lang`:
  * defaults to null when lang is absent (so client auto-detects)
  * preserves an explicit string lang (creator override still works)
  * drops non-string lang values to null rather than coercing to 'en'

Manual verification: with Firefox set to German, loading a fresh pad
now renders the UI in German. Index and timeslider continued to work
as before. Setting `?lang=de` or a language cookie continues to
override browser detection, as intended.

Fixes #7586
2026-04-23 10:38:46 +01:00
..
locales Localisation updates from https://translatewiki.net. 2026-04-20 14:05:28 +02:00
node fix(pad): stop hardcoding lang='en', let the client auto-detect locale (#7586) (#7588) 2026-04-23 10:38:46 +01:00
static fix(editor): preserve U+00A0 non-breaking space (#3037) (#7585) 2026-04-23 08:57:30 +01:00
templates feat: add timeslider line numbers (#7542) 2026-04-19 11:18:54 +01:00
tests fix(pad): stop hardcoding lang='en', let the client auto-detect locale (#7586) (#7588) 2026-04-23 10:38:46 +01:00
.eslintrc.cjs Feat/admin react (#6211) 2024-03-09 23:07:09 +01:00
ep.json 7139 let user maintain a single session across multiple browsers (#7228) 2025-11-18 12:23:55 +01:00
etherpad_icon.svg Change favicon to be closer to new style 2020-04-19 18:20:21 +02:00
package.json build(deps): bump mysql2 from 3.22.1 to 3.22.2 (#7578) 2026-04-22 18:39:08 +01:00
playwright.config.ts chore: show individual test names in CI Playwright output (#7462) 2026-04-05 01:57:49 +01:00
README.md remove one less warning during install by having a readme placeholder 2013-02-10 03:04:08 +00:00
tsconfig.json build(deps-dev): bump the dev-dependencies group with 8 updates (#7429) 2026-04-01 21:33:09 +01:00
vitest.config.ts Feat/changeset ts (#6594) 2024-08-18 12:14:24 +02:00
web.config Added typescript to etherpad 2024-02-05 21:13:02 +01:00

Ignore this file and see the file in the base installation folder