#change sourceLocale.code property, locale data not found

41 messages · Page 1 of 1 (latest)

stuck pasture
#

Hi all, I want to change the default locale (en-US) to nl-NL. Next to this default language I also have en-US and nl-BE.
When I run ng build --localize I got the message: Locale data for 'nl-NL' cannot be found. Using locale data for 'nl'
When I access the build behind /nl the injected LOCALE_ID is 'nl', I want it to be 'nl-NL'.

Below my angular.json configuration:

"i18n": {
    "sourceLocale": {
        "code": "nl-NL",
        "baseHref": "nl/"
    },
    "locales": {
        "en-US": {
            "translation": "src/locale/messages.en.xlf",
            "baseHref": "en/"
        },
        "nl-BE": {
            "translation": "src/locale/messages.be.xlf",
            "baseHref": "be/"
        }
    }
}
reef inlet
#

Not sure that works well tho.

#

what about fr-BE?

#

(not that Im helpful here. But as a Belgian, having worked on localized applications for a long time, that wont work as we have 3 official languages in Belgium)

mystic dagger
#

Which version of Angular are you on?

stuck pasture
stuck pasture
reef inlet
stuck pasture
#

Well, the /en and /be are working perfect

reef inlet
#

Yeah nvm I'm derailing u from the issue.

mystic dagger
#

I don't think nl has any variants in CLDR.

reef inlet
#

if be works, why wouldnt nl ?

#

nl at least is a language, while be isnt.

stuck pasture
#

The texts with the application are in NL, so nl-NL is the source language of my messages.xlf and needs to be the source locale. Translations needs to be done for EN and BE

stuck pasture
#

seems like nl-NL isn't a valid locale, where nl is

mystic dagger
#

That's what I was trying to say.

stuck pasture
#

so, it's perfecly fine: nl, en-US and nl-BE

mystic dagger
mystic dagger
reef inlet
#

Be isn't even a language. We have nl-BE, fr-BE and de-BE

stuck pasture
#

import localeNlBe from '@angular/common/locales/nl-BE';

reef inlet
#

So in angular it's just nl for nl-NL?

mystic dagger
#

Yes. Look at the source linked earlier.

reef inlet
#

So that's wrong then 👍

#

But knowing that should help u solve it @stuck pasture , doesnt it ?

stuck pasture
#

yeah, as said: nl, en-US and nl-BE seems to be right

mystic dagger
#

Let me recheck again.

#

Because I recall having had the same problem with it-IT

reef inlet
#

They probably assume nl-NL is the true nl, but we all know that's nl-BE 🤣

#

Cant u use registerLocale to register nl_NL?

stuck pasture
#

To what extent is the use of registerLocaleData required?

#

If I make the fr language available also, it seems like it's working fine without calling it (tested it using the DatePipe)

#

The Angular CLI automatically includes the locale data and sets the LOCALE_ID value when you use the --localize option with ng build command
So that should make sense that I don't need to call registerLocaleData