angular-gettext-tools
angular-gettext-tools copied to clipboard
Support extraction of strings within ternary + filter
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)
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) }}
?
Will get back to you about the ordering and will attempt a PR after chaos at work has died down this week :)
Hey there, a made a PR here https://github.com/angular-translate/grunt-angular-translate/pull/69
@firehist that's a different project :-)
Yes for sure, but referenced here, so I just bring the info :D
+1, need support for:
<span bs-tooltip="someVar ? ('enabled' | translate) : ('disabled' | translate)"></span>
+1
+1 Any chance of this getting fixed?