[FR]: Support context/comments
Would it be possible, to implement context as this fork https://www.npmjs.com/package/@shavenzov/ngx-translate-extract ?
Note: the feature is described here: https://www.npmjs.com/package/@shavenzov/ngx-translate-extract#context-and-comment-support
I'll leave this to the community to see if someone has the will and ability to implement this. If so, let me know and we can discuss whether that API is the best option.
I created a first running version for us. https://github.com/vandres/ngx-translate-extract
Docs are lacking and I am not sure, if the quality is good enough for a PR. Would love some feedback from you guys!
We are using it with CrowdIn the following way:
ngx-translate-extract -k --input ./src --output ./src/static/assets/i18n/{en,de,fr,it,nl,es,sv,ja,da,no}.json --clean --sort --format context-json --format-context-key crowdinContext --format-value-key text
With marker from https://github.com/vandres/ngx-translate-extract-marker:
marker('We', 'Short for Wednesday');
With Pipe, Service or Directive, just provide a "_context" translate param:
<h3 mat-subheader>{{ "User" | translate: {_context: 'System-User'} }}</h3>
Known issues:
- remove context, after it has been added to the translations files, not automatically possible
- no unit tests for context
- conversion between different json formats untested
Thanks @vandres,
@michaelbromley, would it be possible to take what was done and also support gettext (pot) format ?