From 096fc79a9bad1795b3e25999e5d15577d3b01d55 Mon Sep 17 00:00:00 2001 From: Kim Biesbjerg Date: Tue, 17 Sep 2019 08:25:47 +0200 Subject: [PATCH] Update readme --- README.md | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e018c5b..2c93c23 100644 --- a/README.md +++ b/README.md @@ -2,13 +2,11 @@ If this tool saves you time, please consider making a donation towards the conti [![Donate](images/donate-badge.png)](https://donate.biesbjerg.com) -# Usage - -## ngx-translate-extract +# ngx-translate-extract Extract translatable (ngx-translate) strings and save as a JSON or Gettext pot file. Merges with existing strings if the output file already exists. -### Usage +## Install Install the package in your project: `npm install @biesbjerg/ngx-translate-extract --save-dev` @@ -23,7 +21,7 @@ Add a script to your project's `package.json`: ``` You can now run `npm run extract-i18n` and it will extract strings from your project. -### Examples +## Usage **Extract from dir and save to file** @@ -51,8 +49,8 @@ If you want to use spaces instead, you can do the following: `ngx-translate-extract --input ./src --output ./src/i18n/en.json --format-indentation ' '` -## Mark strings for extraction using a marker function -If, for some reason, you want to extract strings not passed directly to `TranslateService`'s `get()` or `instant()` methods, you can wrap them in a marker function to let `ngx-translate-extract` know you want to extract them. +### Marker function +If you want to extract strings that are not passed directly to `TranslateService`'s `get()`/`instant()`/`stream()` methods, you can wrap them in a marker function to let `ngx-translate-extract` know you want to extract them. Install marker function: `npm install @biesbjerg/ngx-translate-extract-marker` @@ -63,10 +61,6 @@ import { marker } from '@biesbjerg/ngx-translate-extract-marker'; marker('Extract me'); ``` -Add the `marker` argument when running the extract script: - -`ngx-translate-extract ... -m extract` - You can alias the marker function if needed: ```ts @@ -75,9 +69,9 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; _('Extract me'); ``` -`ngx-translate-extract ... -m _` +_Note: `ngx-translate-extract` will automatically detect the import name_ -## Commandline arguments +### Commandline arguments ``` Usage: ngx-translate-extract [options]