rubenv / angular-gettext-tools

Tools for extracting/compiling angular-gettext strings.
http://angular-gettext.rocketeer.be/
MIT License
39 stars 130 forks source link

extraction from es6 inline html #118

Open ctaepper opened 8 years ago

ctaepper commented 8 years ago

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?

rubenv commented 8 years ago

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.

ctaepper commented 8 years ago

any ideas what to do meanwhile? :)

CNBorn commented 8 years ago

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.

mattbrunetti commented 7 years ago

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