lukasgeiter / gettext-extractor

A flexible and powerful Gettext message extractor with support for JavaScript, TypeScript, JSX and HTML.
MIT License
98 stars 21 forks source link

Cannot extract the multiline comments because regex does not seem to match #22

Open pronebird opened 5 years ago

pronebird commented 5 years ago

Hi,

Trying to extract the multine comment that goes as this:

/* TRANSLATORS:
    Line 1
    Line 2
*/
pgettext('context', 'key')

Using the following options for comments:

{
    // take the comment from the preceding line
    otherLineLeading: true,

    // run the comment through regex
    regex: /TRANSLATORS\:\s*(.*)/m
};

It works for single line comments but not for multiline ones. Any idea how to tackle this?

Same happens if I remove the regex option and only leave the otherLineLeading: true

lukasgeiter commented 5 years ago

Hi, as stated in the wiki, multiline comments are currently not supported. I will look into adding this feature with the next release.

In the meantime, as a workaround you could use multiple single line comments:

// TRANSLATORS: Line 1
// TRANSLATORS: Line 2
pgettext('context', 'key')
pronebird commented 5 years ago

Hi, as stated in the wiki, multiline comments are currently not supported.

Ugh my bad, it seems that I've missed this mention.