ngx-translate-extract icon indicating copy to clipboard operation
ngx-translate-extract copied to clipboard

Retrieve context, comments and reference via translate directive

Open felixpis opened this issue 6 years ago • 9 comments

Now in html we can write <span translate translate-context="VERB" translate-comment="This is a title one">Title</span> And then in generated .pot file: # This is a title one #: example/example.html msgctxt "VERB" msgid "Title" msgstr ""

#37

felixpis avatar May 10 '18 12:05 felixpis

Why this is not merged yet?? :cry:

picheli20 avatar Nov 16 '18 14:11 picheli20

@felixpis just a suggestion, I've added the pipe and function as well for the extraction (later I've noticed that the pipe will need some work), if you want to include this base :) https://github.com/picheli20/ngx-translate-extract/commit/a3e198795c6f834f197ac51ca2a83cf80ba03d77

picheli20 avatar Nov 19 '18 14:11 picheli20

Nice @picheli20, however there are some failing tests now (npm run test). Would be great to have this merged! @biesbjerg are you still open to new MR?

bagage avatar Nov 30 '18 15:11 bagage

Also when the same string is used multiple times, only one path is registered in the .pot file. Shouldn't all files be listed?

bagage avatar Nov 30 '18 15:11 bagage

@picheli20 Apologies if this is an inappropriate place to ask, but would be great if you could clarify the following.

Let's say that I use the pipe: {{ 'Home' | translate }}

How can I pass along/express context and comments there?

@felixpis made it clear how it works in the HTML tags, e.g.

<span translate translate-context="Context for home" translate-comment="Comment for home">Home</span>

bram-atmire avatar Dec 09 '18 07:12 bram-atmire

@felixpis do you think you could release this separately on NPM? It doesn't look like it's going to get merged anytime soon

Eugeny avatar Jan 25 '19 11:01 Eugeny

still no merge, please do something! @felixpis, I've noticed that all the comments are being removed upon .po update. For instance my config is ngx-translate-extract --input ./src --output ./src/assets/i18n/*.po --c --f pot and when I have clean .po files (fr.po and en.po) comments are there, Once I run extract, and I need to make un update, all the comments get cleared.

jovpet avatar Jun 14 '19 16:06 jovpet

You can use forked version with added context and comment support. This version adds file path to the item in .po file also.

https://www.npmjs.com/package/@shavenzov/ngx-translate-extract

shavenzov avatar Feb 25 '20 15:02 shavenzov

Hello, any reason why this is not merged yet? Any workarounds available?

philoliver avatar Sep 16 '20 15:09 philoliver