3

In my angular.json on adding fr-Fr locale, I see a message Locale data for 'fr-FR' cannot be found. Using locale data for 'fr' on running command npm run build.

However I see the proper structure in my dist folder with fr-FR generated. Is this a warning that can be ignored or something wrong with my configuration.

"i18n": {
        "sourceLocale": "en",
        "locales": {
          "fr-BE": "src/locale/messages.fr-BE.xlf",
          "fr-CA": "src/locale/messages.fr-CA.xlf",
          "fr-FR": "src/locale/messages.fr-FR.xlf",                      
          "fr-LU": "src/locale/messages.fr-LU.xlf"          
        }
      },

PS: is see the same message for other valid locales like zh-HK and others.

Rajesh
  • 2,472
  • 3
  • 25
  • 31

1 Answers1

2

You must provide the locale in app.module

import { NgModule, LOCALE_ID } from '@angular/core';
import { registerLocaleData } from '@angular/common';
import localeFr from '@angular/common/locales/fr';
registerLocaleData(localeFr);

@NgModule({
  imports: [...],
  declarations: [...],
  bootstrap: [...],
  providers: [
    { provide: LOCALE_ID, useValue: 'fr-FR'},
  ]
})
export class AppModule {}
Haris Bouchlis
  • 2,366
  • 1
  • 20
  • 35
  • 1
    Change my angular.json to fr instead of fr-FR? Is fr-FR not supported locale as per iso639 standards? – Rajesh Nov 24 '21 at 20:28