Skip to content

web/i18n: load the locale catalog before boot and remove msg() thunks - #27618

Merged
GirlBossRush merged 6 commits into
mainfrom
web/locale-boot-modules
Nov 6, 2026
Merged

GirlBossRush merged 6 commits into
mainfrom
web/locale-boot-modules

Conversation

@GirlBossRush

@GirlBossRush GirlBossRush commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Details

 ╭┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╮
 ┆ This PR is a merge branch! ┆
 ╰┄┄┄┄┄┄┄┄┄┬┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄╯

            ╱╲ ╱╲ 
          ╱ ̄(°㇀°⚟) ̄╱╲
         ╱┌──じ㇀し───┐╲╱
          │          │
          │      ǝpoɔ│ ╱
          └─────┄───┄

This PR fixes the order in which authentik loads translations in its frontend. Previously, authentik could evaluate frontend modules before the translation catalog was ready.

For example, a component defines a label at module level:

const labels = {
    username: msg("Username"),
};

If the translation catalog hasn't loaded yet, msg("Username") can return the English fallback instead of the translated value.

Changes

A. Load translations before frontend initialization

The PR changes the startup sequence:

Previously:

  1. Load frontend modules
  2. Evaluate module-level code
  3. Initialize the locale catalog
  4. Render the interface

Now:

  1. Initialize the locale catalog
  2. Wait for initialization to finish
  3. Import frontend interface modules
  4. Render the interface

The important change is that initializeLocale() is awaited before importing the interface

B. Move entrypoint code into separate modules

The bodies of these entrypoints are moved into importable modules:

  • boot.ts
  • ak-rac.ts
  • ak-api-browser.ts

The original entrypoints import these modules.

This allows authentik to execute initialization logic before the interface modules are evaluated.

C. Move the Lit Localize runtime

The Lit Localize runtime is moved to #common/ui/locale/runtime. This centralizes access to the localization runtime.

D. Remove live locale switching

The PR removes several mechanisms that listened for locale changes:

  • The lang observer
  • The activeLanguageTag setter
  • LOCALE_STATUS_EVENT listeners in the admin interface, API locale middleware, captcha stage, and locale selector

Why?

authentik already reloads the page when the language, removing the need to dynamically update the language throughout an already-running frontend

E. Remove msg() thunks from label records

Previously, label records stored functions that needed to be executed to retrieve translated strings

For example:

const label = {
    name: () => msg("Username"),
};

Now, they can store the translated string directly:

const label = {
    name: msg("Username"),
};

@GirlBossRush
GirlBossRush added this pull request to stack #27620 November 4, 2026 18:21
@netlify

netlify Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 3588040
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6aecda21cc44456817458777
😎 Deploy Preview https://deploy-preview-27618--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

⚠️ JUnit XML file not found

The CLI was unable to find any JUnit XML files to upload.
For more help, visit our troubleshooting guide.

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Playwright e2e

Download this run's HTML report and traces, then open the report:

gh run download 42095087788 -D playwright-artifacts
npx playwright show-report playwright-artifacts/playwright-report

Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-3588040a65d778d4d7d64ad7bd5f00d77f1ae15c
# Distroless image: AUTHENTIK_TAG=gh-3588040a65d778d4d7d64ad7bd5f00d77f1ae15c-distroless
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

authentik:
    outposts:
        container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
    image:
        repository: ghcr.io/goauthentik/dev-server
        tag: gh-3588040a65d778d4d7d64ad7bd5f00d77f1ae15c
        # Distroless image: tag: gh-3588040a65d778d4d7d64ad7bd5f00d77f1ae15c-distroless

Afterwards, run the upgrade commands from the latest release notes.

@GirlBossRush GirlBossRush self-assigned this Nov 5, 2026
@GirlBossRush GirlBossRush added the i18n Internationalization and localization label Nov 5, 2026
@GirlBossRush
GirlBossRush marked this pull request as ready for review November 5, 2026 15:21
@GirlBossRush
GirlBossRush requested a review from a team as a code owner November 5, 2026 15:21

@kensternberg-authentik kensternberg-authentik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks coherent. It's a lot of just shuffling things around; the win isn't quite clear to me.

Entrypoints import the moved module, with no change in behavior. This
lets a later change run code before the interface modules evaluate.
The locale is fixed per page since #25156, but the catalog still loaded
from a component lifecycle hook, after every statically imported module
had evaluated. Module-level msg() calls returned English.

- each entrypoint awaits initializeLocale() before importing the interface
- the lit-localize runtime moves to #common/ui/locale/runtime
Switching locale reloads the page since #25156, and the catalog now loads
before boot, so nothing observes a locale change after startup.

- LocaleContextController only provides the runtime; drop the lang observer
- drop the activeLanguageTag setter from WithLocale
- drop LOCALE_STATUS_EVENT listeners in the admin interface, API locale
  middleware, captcha stage, and locale select
The catalog now loads before any interface module evaluates, so label
records can hold translated strings directly.

- label records hold strings instead of MessageFormatter thunks
- call sites read the value instead of calling it
@GirlBossRush
GirlBossRush force-pushed the web/locale-boot-modules branch from 1ef8fbb to 4bdced4 Compare November 5, 2026 19:31
@GirlBossRush GirlBossRush changed the title web: move entrypoint bodies into importable modules web/i18n: load the locale catalog before boot and remove msg() thunks Nov 5, 2026
@GirlBossRush GirlBossRush added the area:frontend Features or issues related to the browser, TypeScript, Node.js, etc label Nov 5, 2026
@GirlBossRush
GirlBossRush enabled auto-merge (squash) November 5, 2026 19:54
@GirlBossRush
GirlBossRush disabled auto-merge November 5, 2026 22:07
@GirlBossRush
GirlBossRush removed this pull request from stack #27620 November 5, 2026 22:07
@GirlBossRush
GirlBossRush merged commit d802b82 into main Nov 6, 2026
520 of 532 checks passed
@GirlBossRush
GirlBossRush deleted the web/locale-boot-modules branch November 6, 2026 00:51
kensternberg-authentik added a commit that referenced this pull request Nov 6, 2026
* main:
  website/docs: dry run: move :ak-version to header (#27678)
  web: policy dry run UI (#26621)
  providers/oauth2: fix max_age=0 not forcing reauth (#27518)
  ci: bump pnpm/action-setup from 6.1.0 to 6.1.1 (#27666)
  core: bump oauthlib from 4.0.0 to 4.0.1 (#27658)
  core: bump psycopg[c,pool] from 3.3.6 to 3.3.7 (#27672)
  core: bump selenium from 4.51.0 to 4.52.0 (#27670)
  ci: bump helm/kind-action from 1.15.1 to 1.15.2 (#27667)
  ci: bump pnpm/action-setup from 6.1.0 to 6.1.1 in /.github/actions/setup (#27668)
  ci: bump the codeql group across 1 directory with 3 updates (#27665)
  ci: bump taiki-e/install-action from 2.89.1 to 2.90.0 in /.github/actions/setup (#27669)
  core: bump goauthentik/fips-python from `69e7058` to `b203e83` in /lifecycle/container (#27664)
  core: bump openapitools/openapi-generator-cli from v7.26.0 to v7.27.0 in /packages/client-go (#27661)
  stages/authenticator_validate: prevent WebAuthn challenge races (#26291)
  web/i18n: load the locale catalog before boot and remove msg() thunks (#27618)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Features or issues related to the browser, TypeScript, Node.js, etc i18n Internationalization and localization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants