
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
ngx-translate-cut
Advanced tools
Angular pipe for cutting translations โ๏ธ ๐ (plugin for @ngx-translate)
โ Angular 20, Angular Universal (SSR), Standalone, Signals and Zoneless compatible
Here's the demo or stackblitz live preview
Make sure you have @ngx-translate library installed, because this is its plugin
Use npm (or yarn) to install the package
npm install ngx-translate-cut
Choose the version corresponding to your Angular version:
| Angular | ngx-translate-cut | Install |
|---|---|---|
| ng20 | 20.x | npm install ngx-translate-cut |
| ng19 | 19.x | npm install ngx-translate-cut@19 |
| ng18 | 18.x | npm install ngx-translate-cut@18 |
| ng17 | 17.x | npm install ngx-translate-cut@17 |
| ng16 | 5.x | npm install ngx-translate-cut@5 |
| ng15 | 4.x | npm install ngx-translate-cut@4 |
| ng14 | 3.x | npm install ngx-translate-cut@3 |
| ng13 | 3.x | npm install ngx-translate-cut@3 |
| ng12 (ivy only) | 2.x | npm install ngx-translate-cut@2 |
| >= 5 =< 12 | 1.x | npm install ngx-translate-cut@1 |
NgxTranslateCutModule into your module imports.File app.module.ts
import { NgxTranslateCutModule } from 'ngx-translate-cut';
@NgModule({
// ...
imports: [
// ...
NgxTranslateCutModule
]
})
Strings are separated with | (pipe sign)
...but you can choose your own symbol
File assets/i18n/en.json
{
"demo": "This is only one 'translate string' with | strong text | and | links"
}
In your template use translateCut:<number> pipe right after translate pipe from @ngx-translate library.
{{ 'demo' | translate | translateCut:0 }}
<strong> {{ 'demo' | translate | translateCut:1 }} </strong>
{{ 'demo' | translate | translateCut:2 }}
<a href="#"> {{ 'demo' | translate | translateCut:3 }} </a>
This is only one 'translate string' with strong text and links
If you are not satisfied with the basic settings of the separator (which is |), you can choose your own separator
import { NgxTranslateCutModule } from 'ngx-translate-cut';
@NgModule({
// ...
imports: [
// ...
NgxTranslateCutModule.forRoot({
// Your separator in translation strings will be `*`
separator: '*'
}),
]
})
If you do not want to trim your translation strings before cutting you can set trim to false (default is true). See this explanation...
import { NgxTranslateCutModule } from 'ngx-translate-cut';
@NgModule({
// ...
imports: [
// ...
NgxTranslateCutModule.forRoot({
trim: false
}),
]
})
Failed to compile.
./node_modules/ngx-translate-cut/fesm2015/ngx-translate-cut.mjs 17:18-28 Can't import the named export 'Injectable' from non EcmaScript module (only default export is available)
You are probably trying to use this library with an older version of Angular (Angular 5 โ 11).
Install copmatibility version instead:
yarn add ngx-translate-cut@1 # for angular 5 โ 11
yarn release:patch
# yarn release:minor
# yarn release:major
-next.0 in package.jsonyarn publish:nextCopyright ยฉ 2025 Lukas Bartak
Proudly powered by nature ๐ป, wind ๐จ, films ๐ฅ, books ๐, tea ๐ต, chili ๐ถ ๏ธand beer ๐บ ;)
All contents are licensed under the MIT license.
If this project have helped you save time please consider making a donation for some ๐บ or ๐ต ;)
Original idea comes from: @yuristsepaniuk in this thread.
FAQs
Angular pipe for cutting translations (plugin for ngx-translate)
The npm package ngx-translate-cut receives a total of 470 weekly downloads. As such, ngx-translate-cut popularity was classified as not popular.
We found that ngx-translate-cut demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.ย It has 1 open source maintainer 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
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.