Skip to content

Commit e2b35f8

Browse files
author
lessjs-bot
committed
fix(i18n): sync locale attribute on SPA content load
_loadContent() now reads locale from fetched page's less-layout and applies it to the current layout, so i18n content renders in the correct language after client-side navigation.
1 parent 87e20a5 commit e2b35f8

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

packages/ui/src/less-layout.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,10 @@ export class LessLayout extends DsdElement {
930930
while (newLayout.firstChild) this.appendChild(newLayout.firstChild);
931931
this.setAttribute('current-path', path);
932932

933+
// Sync locale from the fetched page so i18n content matches
934+
const newLocale = newLayout.getAttribute('locale');
935+
if (newLocale) this.setAttribute('locale', newLocale);
936+
933937
// Ensure newly inserted components inherit current theme.
934938
// First propagation: sync theme to light DOM and shallow shadow DOM.
935939
// Second propagation (rAF): catch components whose connectedCallback fires

www/.less/.external-probe.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import 'parse5';
2+
import 'entities';
3+
import 'hono';

0 commit comments

Comments
 (0)