1.0.8 • Published 2 years ago

ngx-translate-formatjs-compiler v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

ngx-translate-formatjs-compiler Node.js CI npm version CodeQL

Format.js based @ngx/translate compiler.

Supports Angular >= 10

Install

npm i --save intl-messageformat @ngx-translate/core ngx-translate-formatjs-compiler

Integration in @ngx/translate/core

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { TranslateCompiler, TranslateModule } from '@ngx-translate/core';
import { TranslateFormatJsCompiler } from 'ngx-translate-formatjs-compiler';

import { AppComponent } from './app';

@NgModule({
  imports: [
    BrowserModule,
    TranslateModule.forRoot({
      compiler: {
        provide: TranslateCompiler,
        useClass: TranslateFormatJsCompiler,
      },
    }),
  ],
  bootstrap: [AppComponent],
})
export class AppModule {}

Troubleshooting

  • With FormatJS HTML tags must be escaped with a ' in the translation. E.g. '<h1>'Your content goes here'</h1>'
  • With FormatJS interpolation variables are surrounded by single brackets. E.g. I am having {count} cats

Further links

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

1.0.0-alpha.2

2 years ago

1.0.0-alpha.1

2 years ago