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

Add file path to the item in po file

Open mjrdnk opened this issue 7 years ago • 2 comments

Our PMs want to have information about path to the file where translation was found in po files.

Like this:

#: path1WhereStringWasFound:<line#>
#: path2WhereStringWasFound:<line#>
msgid "string"
msgstr "translation"

I would like to create pull request with this feature. I propose that the feature will be activated with yargs flag (e.g.: 'path-info').

By reading your code, I could not find any information about the matching path passed to the extract. Where would you suggest to pass the information about the path? So the compiler could extract them, for example like this:

compilers/po.compiler.ts :

    ...
	translations[key] = {
            paths: paths,    // array of paths where the file was found
	    msgid: key,
            msgstr: collection.get(key)
        };
    ...

Hope this helps others, too. Best

mjrdnk avatar Oct 30 '17 10:10 mjrdnk

Hi, did you manage implementing the above? i also need it...

avgalon avatar Jan 15 '18 10:01 avgalon

See PR #102

dsnoeck avatar Aug 19 '19 08:08 dsnoeck