A compiler for ngx-translate that adds advanced pluralization and gender support using ICU syntax via messageformat.js.
ngx-translate-messageformat-compiler is a compiler plugin for the ngx-translate library in Angular applications. It enables the use of ICU MessageFormat syntax for handling complex translation scenarios like pluralization, gender selection, and custom formatting. It solves the problem of limited pluralization and grammatical support in standard ngx-translate by leveraging the powerful messageformat.js library.
Angular developers building internationalized applications that require advanced localization features such as pluralization based on counts, gender-specific translations, or custom formatting rules.
Developers choose this plugin because it provides a standardized, robust way to handle complex translations within the familiar ngx-translate ecosystem, without needing to switch to a different i18n solution. Its seamless integration and support for ICU syntax make it a powerful upgrade for applications with sophisticated localization requirements.
Advanced pluralization (and more) for ngx-translate, using standard ICU syntax which is compiled with the help of messageformat.js.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Enables standardized ICU MessageFormat for complex translations like pluralization and gender selection, as shown in the example output with 'There are several things' and 'She is influential'.
Acts as a drop-in compiler with minimal configuration—just provide TranslateMessageFormatCompiler in Angular providers, making adoption straightforward for existing ngx-translate users.
Allows defining custom formatting functions via MESSAGE_FORMAT_CONFIG, such as 'upcase' to transform text, extending translation capabilities beyond built-in features.
Includes a debug compiler for logging compilation steps and supports a fallbackPrefix for gradual transition from ngx-translate's default syntax, easing troubleshooting and updates.
Requires 'unsafe-eval' in Content Security Policy due to runtime compilation using new Function(), which can block deployment in secure or regulated environments.
Cannot access nested object properties in placeholders (e.g., {name.first}), a limitation admitted in the README compared to ngx-translate's default double-brace syntax.
Compiles translation strings to JavaScript functions at runtime, which may add slight latency and memory usage, especially with numerous or complex ICU messages.
Relies on ngx-translate and messageformat.js, so updates or bugs in these dependencies can introduce breaking changes or require additional maintenance effort.