Skip to content

extract html attribute #339

Open
Open

Description

@f0x11

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?

Activity

  1. rubenv commented on Jul 31, 2017

    @rubenv
    Owner

    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/

  2. alfaproject commented on Jul 31, 2017

    @alfaproject

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions