Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support extraction of strings within ternary + filter #131

Open
intellix opened this issue Feb 16, 2016 · 8 comments
Open

Support extraction of strings within ternary + filter #131

intellix opened this issue Feb 16, 2016 · 8 comments

Comments

@intellix
Copy link

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: angular-translate/grunt-angular-translate#48)

@intellix intellix changed the title Support ternary with filter Support extraction of strings within ternary + filter Feb 16, 2016
@rubenv
Copy link
Owner

rubenv commented Feb 16, 2016

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
Copy link
Author

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

@firehist
Copy link

Hey there, a made a PR here angular-translate/grunt-angular-translate#69

@rubenv
Copy link
Owner

rubenv commented Feb 23, 2016

@firehist that's a different project :-)

@firehist
Copy link

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

@ntvsx193
Copy link

ntvsx193 commented Apr 8, 2016

+1, need support for:

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

@jehy
Copy link

jehy commented May 6, 2016

+1

@jgerstle
Copy link

+1 Any chance of this getting fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants