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 for ngx-translate #26

Open
thomseno opened this issue Mar 26, 2019 · 2 comments
Open

support for ngx-translate #26

thomseno opened this issue Mar 26, 2019 · 2 comments

Comments

@thomseno
Copy link

The last release of ngx-translate-extract for extracting translatables using ngx-translate is almost two years old, so I thought maybe this project can fill the gap.

The extraction of HTML, TypeScript & Javascript should working out of the box, the "only" feature missing is the "pipe" pattern:

<table>
    <thead>
    <tr>
        <th>{{'BOOKINGS.passengers' | translate}}</th>
        <th>{{'BOOKINGS.children' | translate:params}}</th>
        <th [title]="'BOOKINGS.bookingDate' | translate">#</th>
    </tr>
    </thead>
</table>

("translate" is the getText keyword for extracting messages, param is a TypeScript variable)

What do you think? Probably requires a new HTMLExtractor...

@lukasgeiter
Copy link
Owner

The reason why I haven't implemented such an extractor already, is because of the potential complexity of such expressions. Your examples would be quite simple to parse but in some cases it might contain ternary conditionals and other more complex expressions.

However, it would be interesting to see if Angular exposes its internal parser in a way in which it could be used for this package.

@thomseno
Copy link
Author

I understand.

The parser from ngx-translate-extract is available here pipe.parser.ts

Maybe this helps.

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

No branches or pull requests

2 participants