angular-gettext-tools icon indicating copy to clipboard operation
angular-gettext-tools copied to clipboard

extraction from es6 inline html

Open ctaepper opened this issue 10 years ago • 4 comments
trafficstars

for reasons not important to this issue, i have my html template inside es6 .js files which export the templates as string

// template.js
export default `
  <h1 translate>Heading</h1>
  <p translate>Text in paragraph</p>
`;

notice the backtick which enables multiline html inside js files

when i run the extractor on these file ([email protected], using [email protected]) the tags from these template files dont get extracted

is it me, or is this a bug?

ctaepper avatar Nov 16 '15 22:11 ctaepper

Probably a bug, I don't think we fully parse ES6 yet. We probably need to switch to a new HTML parser to fix that.

rubenv avatar Nov 17 '15 07:11 rubenv

any ideas what to do meanwhile? :)

ctaepper avatar Nov 17 '15 11:11 ctaepper

I think the issue here should be Can angular-gettext-tools parse HTML inside JS file? The answer is no from what I've read from the source code, extracting JS and HTML are now from different functions and they are not interrelated which means it could only recognize HTML stuff from a .html file.

I'd like to see this been implemented as well, as I'm writing Angular Component, bring both presentation and logic of a component together in a single file is whole lot better for code organization. But this approach cannot be used without this feature.

BTW For parsing ES6: I'm not sure if angular-gettext-tools can fully parse ES6 yet, but it's dependency espree does support ES6 now and angular-gettext-tools does have plenty ecmafeatures enabled.

CNBorn avatar Jan 05 '16 21:01 CNBorn

@ctaepper I believe this issue is resolved by PR #163 .. Can you confirm and close this issue?

mattbrunetti avatar Mar 24 '17 18:03 mattbrunetti