New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ngx-translate-debug

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-translate-debug

Plugin for ngx-translate that helps debug translation keys

latest
Source
npmnpm
Version
0.1.4
Version published
Maintainers
1
Created
Source

ngx-translate-debug

Plugin for ngx-translate that helps debug translation keys 🔑

Here's the DEMO or edit on StackBlitz

Install

Make sure you have installed @ngx-translate library

  • Use npm to install the package
npm i ngx-translate-debug
  • Add custom parser for TranslateModule
import { NgxTranslateDebugParser } from 'ngx-translate-debug';

@NgModule({
  // ...
  imports: [
    // ...
    TranslateModule.forRoot({
      // ...
      parser: { provide: TranslateParser, useClass: NgxTranslateDebugParser }, // <--- ADD THIS LINE
    }),
  ]
})

Usage

  • Inject NgxTranslateDebugService in component's constructor
import { NgxTranslateDebugService } from 'ngx-translate-debug';

export class AppComponent {
  constructor(
    // ...
    public translateDebugService: NgxTranslateDebugService // <--- ADD THIS LINE
  ) {
    // ...
  }
}
  • Use methods of NgxTranslateDebugService
<button type="button" (click)="translateDebugService.toggleDebug()">
  Toggle debug mode
</button>

<button type="button" (click)="translateDebugService.enableDebug()">
  Enable debug mode
</button>

<button type="button" (click)="translateDebugService.disableDebug()">
  Disable debug mode
</button>
  • The plugin records the last state in window.localStorage['ngx-translate-debug']. You can change key by providing config in root module
import { NGX_TRANSLATE_DEBUG_CONFIG } from 'ngx-translate-debug';

@NgModule({
  // ...
  providers: [
    // ...
    {
      provide: NGX_TRANSLATE_DEBUG_CONFIG,
      useValue: {
        localStorageKey: 'any-custom-key',
      },
    },
  ],
})
export class AppModule {}

Dependencies

@ngx-translate/core

License

MIT

Keywords

ngx-translate

FAQs

Package last updated on 07 Mar 2021

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