Angular 19: "Missing locale data for the locale 'es-ES'" even after registering locale data

Discussão em 'Angular' iniciado por Newsha Nik, Fevereiro 23, 2025.

  1. Newsha Nik

    Newsha Nik Guest

    I'm working on an Angular 19 project and trying to set the locale to Spanish (es-ES) to format currency correctly. I have added the following code to my main.ts file:

    import { registerLocaleData } from '@angular/common';
    import localeEs from '@angular/common/locales/es';

    registerLocaleData(localeEs, 'es-ES');


    In my template, I'm using the CurrencyPipe like this:

    <strong>{{
    +item.price | currency : 'EUR' : undefined : undefined : 'es-ES'
    }}</strong>


    The euro symbol (€) is displayed correctly, so it seems like the locale is applied. However, I'm still getting the following error in the terminal:

    ERROR RuntimeError: NG0701: Missing locale data for the locale "es-ES".
    at findLocaleData
    at getLocaleCurrencies
    at getCurrencySymbol
    at _CurrencyPipe.transform
    at pureFunctionVInternal
    at Module.ɵɵpipeBindV
    at ItemListComponent_For_2_Template

    Continue reading...

Compartilhe esta Página