Open Closed

Problem with localization registration after updating to Abp 8.3.4 #9187


User avatar
0
JanneHarju created

Angular version is 18.2.13 as suggested in 8.3 upgrade guide. I got error in browser console but everything seems to be working. Original error:

Cannot find the fi-FI locale file. You can check how can add new culture at https://abp.io/docs/latest/framework/ui/angular/localization#adding-a-new-culture

original related code:

import { registerLocaleData } from '@angular/common';
import { registerLocale } from '@volo/abp.ng.language-management/locale';
registerLocaleData(localeFi);
provideAbpCore(
  withOptions({
    environment,
    registerLocaleFn: registerLocale(),
  }),
)

After I read this guide https://abp.io/docs/latest/framework/ui/angular/localization#adding-a-new-culture I added this code.

import { differentLocales } from '@abp/ng.core';
export function registerLocale(locale: string) {
  return import(
    /* webpackChunkName: "_locale-[request]"*/
    /* webpackInclude: /[/\\](/docs/latest/framework/ui/angular/en%7Cfi).js/ */
    /* webpackExclude: /[/\\]global|extra/ */
    `@angular/common/locales/${differentLocales[locale] || locale}.js`
  );
}

and I also tried to add localization through angular.json polyfills array like this.

"polyfills": [
  "src/polyfills.ts",
  "@angular/localize/init",
  "@angular/common/locales/fi"
],

Exception what I get in browser console is this:

TypeError: Failed to resolve module specifier '@angular/common/locales/fi.js'
    at registerLocale (app.module.ts:74:60)

74 line is @angular/common/locales/${differentLocales[locale] || locale}.js

I also tried this compination.

import { registerLocale } from '@abp/ng.core/locale';
provideAbpCore(
  withOptions({
    environment,
    registerLocaleFn: registerLocale({
      cultureNameLocaleFileMap: {
        'fi-FI': 'fi',
      },
      errorHandlerFn: error => {
        console.error('Error registering locale:', error);
      },
    }),
  }),
),

but no luck.

So how those localizations should be loaded?

ps. this makes no sence in abp support form. Which one is yes, MVC or Angular?


8 Answer(s)
  • User Avatar
    0
    LW created

    Is there any solution for the localization problem? Is this a known problem or are we missing something here?

  • User Avatar
    0
    erdem.caygor created
    Support Team

    Hello, Thank you for reporting the issue and providing such detailed context. I'll look into the problem and try to reproduce it on my end. I'll get back to you with more information or a possible fix as soon as possible.

  • User Avatar
    0
    JanneHarju created

    May I add that I get those errors only when running proejct locally with ng serve. When I publish my project to server there is no errors in console.

  • User Avatar
    0
    erdem.caygor created
    Support Team

    Hello, I’ve attempted to reproduce the issue locally but I haven’t been able to encounter the same error during ng serve. Would you mind sharing a minimal example project that reproduces the issue? You can either upload it to GitHub or send it directly to me at erdem.caygor@volosoft.com Best regards

  • User Avatar
    0
    JanneHarju created

    I'm returning this later

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    [JanneHarju] said: I'm returning this later

    Hi, is there any update?

  • User Avatar
    0
    JanneHarju created

    Not yet. I'm figuring that how big work is to make minimal reproduce project. Did you use same angular version because I think it was related to that.

  • User Avatar
    0
    EngincanV created
    Support Team .NET Developer

    [JanneHarju] said: Not yet. I'm figuring that how big work is to make minimal reproduce project. Did you use same angular version because I think it was related to that.

    @erdem.caygor attempted to reproduce the issue using a fresh template, but was unable to. This is exactly why we kindly requested a minimal reproducible project, it helps us better understand and assist you with the problem. So, if you can provide us a minimal project, we can directly help you.

    Regards.

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.0.0-preview. Updated on September 01, 2025, 08:37