Open Closed

Bug: withThemeLeptonXOptions breaks LeptonX settings menu localization in Angular #10749


User avatar
0
papusa created

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.

Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

5 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent
    • 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_PROVIDER after provideThemeLeptonX(...).

    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)
  • User Avatar
    0
    papusa created
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    You're right, this is a provider-order bug on our side. When you pass withThemeLeptonXOptions(...), that feature internally calls provideLpx(...) 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_PROVIDER from @volosoft/abp.ng.theme.lepton-x and add it after provideThemeLeptonX(...) 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 provideThemeLeptonX in 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)
  • User Avatar
    0
    papusa created

    Thank you

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    ๐Ÿ‘

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with โค๏ธ on ABP v10.8.0-preview. Updated on September 28, 2026, 11:44
1
ABP Assistant
๐Ÿ” You need to be logged in to use the chatbot. Please log in first.