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

extract html attribute #339

Open
f0x11 opened this issue Jul 31, 2017 · 2 comments
Open

extract html attribute #339

f0x11 opened this issue Jul 31, 2017 · 2 comments

Comments

@f0x11
Copy link

f0x11 commented Jul 31, 2017

I have an attribute,
<a content="{{expand ? 'a.' : 'b.'}}">
I want add a 'translate', then get a pot file contains "a" and "b". How can I do it?

@rubenv
Copy link
Owner

rubenv commented Jul 31, 2017

Not ideal, but there's an approach that works:

Put them on the scope and translate from directly.

$scope.a = gettext('a.');
$scope.b = gettext('b.');

The gettext() wrapper is key to annotate the strings for translation.

And somewhere (we put it on the root scope):

$scope.translate = gettextCatalog.getString;

This then becomes:

<a content="{{translate(expand ? a : b)}}">

More info: https://angular-gettext.rocketeer.be/dev-guide/annotate-js/

@alfaproject
Copy link
Contributor

If you do the scope annotation then you can use the filter on the view btw

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

3 participants