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?
4 Answer(s)
-
0
Is there any solution for the localization problem? Is this a known problem or are we missing something here?
-
0
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.
-
0
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.
-
0
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