Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LOCALE_ID token returns object instead of string #21876

Open
1 task done
Ilkhom-S opened this issue Jan 12, 2025 · 0 comments
Open
1 task done

LOCALE_ID token returns object instead of string #21876

Ilkhom-S opened this issue Jan 12, 2025 · 0 comments
Labels

Comments

@Ilkhom-S
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Description

When inject LOCALE_ID. It returns object instead of string. I analyze source and found that you are using locale.provider.ts to return locale. But becuase of using useClass:LocaleId it is registering as object regardless of extending from string on your class. Adn side effect of it ab-range-dateteimpicker is not showing correct locale.

Instead of useClass . We can use useFactory and all pipes and abp-datepicker will show corrrect locale .

export const LocaleProvider: Provider = {
  provide: LOCALE_ID,
  useFactory: (localizationService: LocalizationService) => {
    const { currentLang } = localizationService;
    return checkHasProp(differentLocales, currentLang)
      ? differentLocales[currentLang]
      : currentLang.toString();
  },
  deps: [LocalizationService],
};

I tested in my project. All ngb-bootstrap components where LOCALE_Id token used. It starts working. So you can change current implementation.

Reproduction Steps

No response

Expected behavior

No response

Actual behavior

No response

Regression?

No response

Known Workarounds

No response

Version

9.0.3

User Interface

Angular

Database Provider

EF Core (Default)

Tiered or separate authentication server

None (Default)

Operation System

Windows (Default)

Other information

No response

@Ilkhom-S Ilkhom-S added the bug label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant