๐Ÿš€ DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more โ†’
Socket
Book a DemoInstallSign in
Socket

ngx-translate-cut

Package Overview
Dependencies
Maintainers
1
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-translate-cut

Angular pipe for cutting translations (plugin for ngx-translate)

latest
Source
npmnpm
Version
20.2.0
Version published
Weekly downloads
547
32.13%
Maintainers
1
Weekly downloads
ย 
Created
Source

โœ‚๏ธ๐ŸŒ NgxTranslateCut Pipe

npm version Package License Build & Publish NPM Downloads codecov

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

Install

  • 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:

Angularngx-translate-cutInstall
ng2020.xnpm install ngx-translate-cut
ng1919.xnpm install ngx-translate-cut@19
ng1818.xnpm install ngx-translate-cut@18
ng1717.xnpm install ngx-translate-cut@17
ng165.xnpm install ngx-translate-cut@5
ng154.xnpm install ngx-translate-cut@4
ng143.xnpm install ngx-translate-cut@3
ng133.xnpm install ngx-translate-cut@3
ng12 (ivy only)2.xnpm install ngx-translate-cut@2
>= 5 =< 121.xnpm install ngx-translate-cut@1
  • Add NgxTranslateCutModule into your module imports.

File app.module.ts

  import { NgxTranslateCutModule } from 'ngx-translate-cut';

  @NgModule({
   // ...
   imports: [
     // ...
     NgxTranslateCutModule
   ]
  })

Usage

Definition

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"
}

Example code

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>

Result

This is only one 'translate string' with strong text and links

Options

Separator

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: '*'
    }),
   ]
  })

Trim

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
    }),
   ]
  })

Dependencies

@ngx-translate/core

FAQ

Older Angular

Error

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)

Solution

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

Development (notes for me)

Publish Stable

yarn release:patch
# yarn release:minor
# yarn release:major

Publish next channel

  • Bump version -next.0 in package.json
  • yarn publish:next

License

Copyright ยฉ 2025 Lukas Bartak

Proudly powered by nature ๐Ÿ—ป, wind ๐Ÿ’จ, films ๐ŸŽฅ, books ๐Ÿ“–, tea ๐Ÿต, chili ๐ŸŒถ ๏ธand beer ๐Ÿบ ;)

All contents are licensed under the MIT license.

Donation

If this project have helped you save time please consider making a donation for some ๐Ÿบ or ๐Ÿต ;)

Thanks to

Original idea comes from: @yuristsepaniuk in this thread.

Keywords

angular

FAQs

Package last updated on 25 Oct 2025

Did you know?

Socket

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.

Install

Related posts