zaach / jsxgettext

Extract gettext calls from JavaScript, EJS, and other template formats.
Mozilla Public License 2.0
105 stars 56 forks source link

Extraction from jade templates, mixins don't work #99

Closed gerotakke closed 8 years ago

gerotakke commented 8 years ago

As the title says, extraction doesn't work when the translated string is a parameter of a mixin. I've hacked around a bit and found that there's a token type "call" that isn't handled in parsers/jade.js. I got it to work by simply adding this:

      case 'call':
        append.call(token, extractGettext(token.args));
      break;

My tests look very promising but it seems a bit too straightforward. Should I submit a PR? Anything else I can do?

BYK commented 8 years ago

I'd just submit a PR and make sure it has new tests to verify the behavior (and also not break any old tests).

Until me or someone else has time to implement proper parsing/AST based extraction for languages other than JavaScript, I don't think we can do much better.

gerotakke commented 8 years ago

I just noticed that strings inside of mixins aren't extracted as well, also after the changes in PR. Will look into it as soon as I have the time. -- edit: Forget that, the texts were actually in another mixin and I tested with the unpatched version. Sorry!

BYK commented 8 years ago

Thank you!

On Thu, Jan 7, 2016, 14:32 gerotakke notifications@github.com wrote:

I just noticed that strings inside of mixins aren't extracted as well, also after the changes in PR. Will look into it as soon as I have the time.

— Reply to this email directly or view it on GitHub https://github.com/zaach/jsxgettext/issues/99#issuecomment-169649859.

BYK commented 8 years ago

Guessing this is closed by #100?

gerotakke commented 8 years ago

Yep, thanks!