![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
ngx-translate-messageformat-compiler
Advanced tools
Compiler for ngx-translate that uses messageformat.js to compile translations using ICU syntax for handling pluralization and gender
Compiler for ngx-translate that uses messageformat.js to compile translations using ICU syntax for handling pluralization and gender
This assumes that you've already installed ngx-translate.
Using npm
:
npm install ngx-translate-messageformat-compiler messageformat --save
... or if you use yarn
:
yarn add ngx-translate-messageformat-compiler messageformat
You need to configure TranslateModule
so it uses TranslateMessageFormatCompiler
as the compiler:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { TranslateCompiler, TranslateModule } from '@ngx-translate/core';
import * as MessageFormat from 'messageformat';
import { TranslateMessageFormatCompiler } from 'ngx-translate-messageformat-compiler';
import { AppComponent } from "./app";
@NgModule({
imports: [
BrowserModule,
TranslateModule.forRoot({
compiler: {
provide: TranslateCompiler,
useFactory: () => new TranslateMessageFormatCompiler(new MessageFormat())
}
})
],
bootstrap: [AppComponent]
})
export class AppModule {}
Please note that while you can still use nesting in your translations ({ login: { welcome: 'Welcome!' }}
) with respective keys (login.welcome
), you lose the ability to access object properties in your placeholders: 'Hello {name.first} {name.last}'
won't work. Also note that this format uses single braces instead of double braces for placeholders.
If you're here, you probably know what you're looking for. If you do wonder what this is, here's a brief explanation.
ICU Message Format is a standardized syntax for dealing with the translation of user-visible strings into various languages that may have different requirements for the correct declension of words (e.g. according to number, gender, case) - or to simplify: pluralization.
Messageformat.js is a compliant implementation for Javascript.
Back in Angular 1, angular-translate, formerly by @PascalPrecht, provided support for ICU syntax using messageformat.js. This compiler "plugin" adds the same rich pluralization support to the excellent ngx-translate. Thanks to @ocombe for his work and his support in getting pluggable compiler support into the core. Thanks also to @PascalPrecht for suggesting a contribution when I talked to him about this at Jazoon.
[1.1.0] - 2017-09-27
TranslateMessageFormatCompiler
's constructor and throw a
TypeError
otherwise.FAQs
> Compiler for ngx-translate that uses messageformat.js to compile translations using ICU syntax for handling pluralization and gender
The npm package ngx-translate-messageformat-compiler receives a total of 32,155 weekly downloads. As such, ngx-translate-messageformat-compiler popularity was classified as popular.
We found that ngx-translate-messageformat-compiler demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.