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)
-
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
-
0
I'm returning this later
-
0
[JanneHarju] said: I'm returning this later
Hi, is there any update?
-
0
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.
-
0
[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.