rubenv / angular-gettext-tools

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

Support extraction of strings within ternary + filter #131

Open intellix opened 8 years ago

intellix commented 8 years ago

We were using quite a few instances of this and found that it wasn't being extracted for translation:

{{ app.showingMore ? 'Show less' : 'Show more' | translate }}

We've had to switch to having two ngIf, but you sometimes get a flicker of both strings as state switches (Show lessShow more):

<button>
  <span ng-if="app.showingMore" translate>Show less</span>
  <span ng-if="!app.showingMore" translate>Show more</span>
</button>

Not sure if this ever worked, but guess it would be a nice thing to support.

(Tried searching for another ticket but couldn't find one. It seems a similar ticket was created here: https://github.com/angular-translate/grunt-angular-translate/issues/48)

rubenv commented 8 years ago

Would welcome a pull request!

How do priorities work in Angular? Does the above get parsed as

{{ (app.showingMore ? 'Show less' : 'Show more') | translate }}

or

{{ app.showingMore ? 'Show less' : ('Show more' | translate) }}

?

intellix commented 8 years ago

Will get back to you about the ordering and will attempt a PR after chaos at work has died down this week :)

firehist commented 8 years ago

Hey there, a made a PR here https://github.com/angular-translate/grunt-angular-translate/pull/69

rubenv commented 8 years ago

@firehist that's a different project :-)

firehist commented 8 years ago

Yes for sure, but referenced here, so I just bring the info :D

ntvsx193 commented 8 years ago

+1, need support for:

<span bs-tooltip="someVar ? ('enabled' | translate) : ('disabled' | translate)"></span>
jehy commented 8 years ago

+1

jgerstle commented 7 years ago

+1 Any chance of this getting fixed?