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

Can't extract from angular template component input attributes #31

Open
konuch opened this issue Jul 22, 2019 · 5 comments
Open

Can't extract from angular template component input attributes #31

konuch opened this issue Jul 22, 2019 · 5 comments

Comments

@konuch
Copy link

konuch commented Jul 22, 2019

I have the following angular template:

<div [myAngularInput]="__('Click to Import')">{{__('Import')}}</div>

The 'Import' string is successfully extracted using your lib, but the 'Click to Import' text is ignored. I assume this happens because the latter is not enclosed in double curly braces. Is there a way we could make this work?

Thanks in advance.

This is my core extractor code:

const ALLOWED_METHODS = ['[this].__', '__', '[this].translate.getInstant', 'TranslateService.getInstant'];

let extractor = new GettextExtractor();

extractor
    .createJsParser([
        JsExtractors.callExpression(ALLOWED_METHODS, {
            arguments: {
                text: 0,
                context: 1
            }
        }),
        JsExtractors.callExpression(ALLOWED_METHODS, {
            arguments: {
                text: 1,
                textPlural: 2,
                context: 3
            }
        })
    ])
    .parseFilesGlob('./src/app/**/*.@(js|jsx|ts|html)');
@konuch konuch changed the title Can't extract from angular component input attributes Can't extract from angular template component input attributes Jul 22, 2019
@lukasgeiter
Copy link
Owner

The fact that 'Import' is extracted is actually kind of surprising to me because you're effectively running HTML through the TypeScript parser. My guess is that the parser treats the HTML as JSX and is therefore able to find code that's contained within curly braces.

Unfortunately extracting such messages is not supported at the moment. The good news is that the next major release will include full support for angular templates out of the box. This includes your example. I will update this issue as soon as the release is out.

@jotoeri
Copy link

jotoeri commented Mar 22, 2021

Hey @lukasgeiter,

slight and polite ping! 🙈
Any news on your rewrite? On nextcloud-vue we have similar problems with webpack & vue: nextcloud-vue/SettingsSection.vue#L51

Greets! 🙂
Jonas

@lukasgeiter
Copy link
Owner

@jotoeri Thanks for your interest!

I'm sorry that the rewrite is taking longer than expected. For a quite a while I was not able to work on the project at all.
Now I'm back at it though and making steady progress... Thank you for your patience 🙏

@sorinfratila
Copy link

Hi @lukasgeiter , any news on updates about this new release to support angular template ?

@lukasgeiter
Copy link
Owner

Hi @sorinfratila!

Sorry, I don't have any news at this time. I'm currently unable to spend time on the project and don't want to make any promises. I'll let you know once that changes. Thanks for understanding.

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

4 participants