nativescript-angular icon indicating copy to clipboard operation
nativescript-angular copied to clipboard

Support for Angular 5 i18n APIs

Open sis0k0 opened this issue 7 years ago • 5 comments

Research if the new i18n tooling can replace the nativescript-intl package.

sis0k0 avatar Dec 20 '17 15:12 sis0k0

...we need this! :)

YvesCandel avatar Jan 11 '18 14:01 YvesCandel

Any updates?

danieloprado avatar Apr 09 '18 20:04 danieloprado

We really need this! Any updates??

I followed the approach suggested by @hettiger on this issue and the solution works. However, it can cause lots of problems, as he mentioned, whenever there's an update on that. I was wondering if someone has another idea in mind.

I tried replacing the ES6 import statement by the old require like require localeFr = require('@angular/common/locales/fr'); but it only works for iOS for some reason.

luanReis avatar Jun 21 '18 17:06 luanReis

Hi guys, I found a solution to this issue. I follow the answer from @hettiger on this issue and the approach suggested by @luanReis .

I tried maintaining the new "import" and don't change any file or position. I worked with italian but I think this will be the right solution for each language:

In my file app.module.ts I put the following code:

import { LOCALE_ID } from "@angular/core";
import  localeIt from '@angular/common/locales/it';
registerLocaleData(localeIt);

and in the same file as providers I wrote: providers: [ { provide: LOCALE_ID, useValue: "it" } ]

Now it works perfectly. Hope this will be helpful

bsiilvia avatar Feb 21 '20 08:02 bsiilvia