Update readme
This commit is contained in:
		
							
								
								
									
										20
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								README.md
									
									
									
									
									
								
							| @@ -2,13 +2,11 @@ If this tool saves you time, please consider making a donation towards the conti | |||||||
|  |  | ||||||
| [](https://donate.biesbjerg.com) | [](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. | Extract translatable (ngx-translate) strings and save as a JSON or Gettext pot file. | ||||||
| Merges with existing strings if the output file already exists. | Merges with existing strings if the output file already exists. | ||||||
|  |  | ||||||
| ### Usage | ## Install | ||||||
| Install the package in your project: | Install the package in your project: | ||||||
|  |  | ||||||
| `npm install @biesbjerg/ngx-translate-extract --save-dev` | `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. | 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** | **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 '  '` | `ngx-translate-extract --input ./src --output ./src/i18n/en.json --format-indentation '  '` | ||||||
|  |  | ||||||
| ## Mark strings for extraction using a marker function | ### 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. | 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: | Install marker function: | ||||||
| `npm install @biesbjerg/ngx-translate-extract-marker` | `npm install @biesbjerg/ngx-translate-extract-marker` | ||||||
| @@ -63,10 +61,6 @@ import { marker } from '@biesbjerg/ngx-translate-extract-marker'; | |||||||
| marker('Extract me'); | 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: | You can alias the marker function if needed: | ||||||
|  |  | ||||||
| ```ts | ```ts | ||||||
| @@ -75,9 +69,9 @@ import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; | |||||||
| _('Extract me'); | _('Extract me'); | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| `ngx-translate-extract ... -m _` | _Note: `ngx-translate-extract` will automatically detect the import name_ | ||||||
|  |  | ||||||
| ## Commandline arguments | ### Commandline arguments | ||||||
| ``` | ``` | ||||||
| Usage: | Usage: | ||||||
| ngx-translate-extract [options] | ngx-translate-extract [options] | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user