2.0.8 • Published 1 year ago

@colsen1991/ngx-translate-extract-marker v2.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ngx-translate-extract-marker

This is a fork of a great library by Kim Biesbjerg, but as far as I can tell the original library is unfortunately no longer being developed

Installation

$ npm install @colsen1991/ngx-translate-extract-marker

Important notice

The marker pipe and directive is not supported in Kim's ngx-translate-extract package. Please use my fork instead: $ npm install @colsen1991/ngx-translate-extract.

Mark strings for extraction using the marker function

If, for some reason, you want to extract strings not passed directly to ngx-translate/TranslateService's get(), instant() or stream() methods, you can wrap them in a custom marker function to let ngx-translate-extract know you want to extract them.

Import and use the marker function:

import { marker } from '@colsen1991/ngx-translate-extract-marker';

marker('Extract me');

Or you can alias the marker() method:

import { marker as _ } from '@colsen1991/ngx-translate-extract-marker';

_('Extract me');

Then run the extract script: $ ngx-translate-extract

Mark strings for extraction using the marker pipe

If, for some reason, you want to extract strings not passed directly to ngx-translate/TranslatePipe, you can pass them into a custom marker pipe to let ngx-translate-extract know you want to extract them.

Import and use the marker pipe in your @NgModule:

import { MarkerPipe } from '@colsen1991/ngx-translate-extract-marker/extras';

@NgModule({ declarations: [MarkerPipe] })
export class YourModule {
}

Then mark strings in your templates:

<your-component [yourInput]="'Hello world' | marker"></your-component>

Mark strings for extraction using the marker directive

If, for some reason, you want to extract strings not passed directly to ngx-translate/TranslateDirective, you can wrap them in a custom marker directive to let ngx-translate-extract know you want to extract them.

Import and use the marker directive in your @NgModule:

import { MarkerDirective } from '@colsen1991/ngx-translate-extract-marker/extras';

@NgModule({ declarations: [MarkerDirective] })
export class YourModule {}

Then mark strings in your templates:

<p marker>Hello World</p>

Then run the extract script: $ ngx-translate-extract

ngx-translate-extract-marker module

You may also import the marker pipe and directive as a module:

import { MarkerModule } from '@colsen1991/ngx-translate-extract-marker/extras';

@NgModule({ imports: [MarkerModule] })
export class YourModule {}

ngx-translate-extract

See ngx-translate-extract and ngx-translate for more details.

Credits

Original library, idea and code: @biesbjerg/ngx-translate-extract-marker ❤️

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago