angular-gettext-tools icon indicating copy to clipboard operation
angular-gettext-tools copied to clipboard

Support extraction of strings within ternary + filter

Open intellix opened this issue 8 years ago • 8 comments

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)

intellix avatar Feb 16 '16 10:02 intellix

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) }}

?

rubenv avatar Feb 16 '16 10:02 rubenv

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

intellix avatar Feb 16 '16 11:02 intellix

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

firehist avatar Feb 23 '16 15:02 firehist

@firehist that's a different project :-)

rubenv avatar Feb 23 '16 15:02 rubenv

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

firehist avatar Feb 24 '16 09:02 firehist

+1, need support for:

<span bs-tooltip="someVar ? ('enabled' | translate) : ('disabled' | translate)"></span>

ntvsx193 avatar Apr 08 '16 15:04 ntvsx193

+1

jehy avatar May 06 '16 13:05 jehy

+1 Any chance of this getting fixed?

jgerstle avatar Jan 16 '17 13:01 jgerstle