Hi!
When provideThemeLeptonX() is used with withThemeLeptonXOptions(), the settings menu shows hardcoded English labels (e.g. "General Settings", "Language Options") instead of localized strings from the LeptonX resource, even when translations exist on the backend.
Steps to reproduce:
- Configure LeptonX with theme options:
provideThemeLeptonX(
withThemeLeptonXOptions({
defaultTheme: 'dim',
}),
),
- Switch the UI language to Swedish (or another non-English locale).
- Open the settings menu (gear icon).
- Observe that "General Settings" and "Language Options" remain in English.
Root cause looks like a provider order issue: withThemeLeptonXOptions causes DefaultTranslateService to override AbpTranslateService.
I found a workaround, re-registering the ABP translate provider after provideThemeLeptonX(...) is solving the issue:
provideThemeLeptonX(
withThemeLeptonXOptions({ /* ... */ }),
),
LPX_TRANSLATE_PROVIDER,
However, I think it still should be fixed on ABP side.
5 Answer(s)
-
0
Youโve already found the correct workaround for ABP 10.1.1 + Angular + LeptonX: ensure the ABP translation provider stays the active one after calling
provideThemeLeptonX(withThemeLeptonXOptions(...)), because that call chain ends up registering a translate service/provider that takes precedence and makes LeptonX fall back to its default (English) labels in the settings context menu.Use this in your
app.config.ts(or wherever you define Angular providers), keeping ABPโs translate provider last:
import { provideThemeLeptonX, withThemeLeptonXOptions } from '@volosoft/abp.ng.theme.lepton-x'; // or @abp/ng.theme.lepton-x depending on your package import { LPX_TRANSLATE_PROVIDER } from '@volosoft/ngx-lepton-x'; // your workaround export const appConfig = { providers: [ provideThemeLeptonX( withThemeLeptonXOptions({ defaultTheme: 'dim', }), ), // Ensure LeptonX uses ABP's translation pipeline (fixes settings menu localization) LPX_TRANSLATE_PROVIDER, ], };What to do โon ABP sideโ: this should be fixed by adjusting provider registration order inside the implementation of
withThemeLeptonXOptions()/provideThemeLeptonX()so that it doesnโt override ABPโs translate service (or so it re-exports/aliases ABPโs translation service instead of registering a different default). I canโt verify the exact internal source from the indexed repos available in my tools (no repo code match found for these Angular symbols), so I canโt point to the exact file/line to change.If you want this officially addressed, please open a support ticket / issue with your minimal reproduction and the provider-order diagnosis; include that the workaround is to re-add
LPX_TRANSLATE_PROVIDERafterprovideThemeLeptonX(...).
Links (validated):
- https://abp.io/docs/10.1/ui-themes/lepton-x/angular/how-to-change-default-theme-option
- https://abp.io/docs/latest/framework/ui/angular/theme-configurations
This response was generated by AI. If it didnโt solve your problem, feel free to post a new answer โ our support team will jump in to help you soon.
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post) -
0
Hi,
You're right, this is a provider-order bug on our side. When you pass
withThemeLeptonXOptions(...), that feature internally callsprovideLpx(...)again, which re-registers the default (English) translate service after the ABP one. Angular DI keeps the last provider for a given token, so the default service wins and the settings menu ("General Settings", "Language Options", ...) falls back to its hardcoded English labels.Your workaround is the right approach. Just import
LPX_TRANSLATE_PROVIDERfrom@volosoft/abp.ng.theme.lepton-xand add it afterprovideThemeLeptonX(...)so the ABP translate service stays the active one:import { provideThemeLeptonX, withThemeLeptonXOptions, LPX_TRANSLATE_PROVIDER, } from '@volosoft/abp.ng.theme.lepton-x'; providers: [ provideThemeLeptonX( withThemeLeptonXOptions({ defaultTheme: 'dim', }), ), LPX_TRANSLATE_PROVIDER, ]We'll fix this inside
provideThemeLeptonXin the next LeptonX release so the extra provider won't be needed.Thanks
Markdown supported.Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)