rubenv / angular-gettext-tools

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

add removeWhiteSpaces option to remove spaces from msgids in compile #152

Closed murataydos closed 8 years ago

murataydos commented 8 years ago

@rubenv Can you review this PR please?

I added an option to compile so that it can remove whitespaces from msgid.

Why do we need this? When we compile angular templates, all the whitespaces are also removed. So some of the strings don't match with the ones in translation dictionary.

Example angular template:

<div translate>Hello
               World</div>

translation dictionary:

{
  ...
  "Hello\n      World": "..."
  ...
}

compiled template:

<div translate>Hello World</div>

translation dictionary if removeWhiteSpaces option is set to true:

{
  ...
  "Hello World": "..."
  ...
}
murataydos commented 8 years ago

@rubenv A reminder of this pull request. It would be great if you can review this. Thanks.

rubenv commented 8 years ago

I'm not sure I want to go down the road of building all possible post-processing into angular-gettext.

As an alternative, have you considered extracting strings from the compiled templates?

If that is not an option, I'd recommend a separate build step which processes the .pot file, rather than adding more features to angular-gettext.

murataydos commented 8 years ago

Development environment doesn't use compiled templates, so extracting strings from compiled templates wouldn't help much since we want to be able to test it in development environment too.

Adding another build step makes sense.

Thanks.

rubenv commented 8 years ago

Should be relatively easy with https://github.com/rubenv/pofile, which is what angular-gettext uses internally.