rubenv/angular-gettext-tools

extraction from es6 inline html

Opened this issue · 4 comments

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 (angular-gettext-cli@1.0.5, using angular-gettext-tools@1.2.0) the tags from these template files dont get extracted

is it me, or is this a bug?

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.

any ideas what to do meanwhile? :)

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.

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