I'm currently using ngx-translate-extract and found a problem with dynamic translations.
Let's say we have 2 variables
const a = 'First';
const b = 'Second';
and you want to use final translate string like
const c = '${translate.instant(a)} ${translate.instant(b)}';
Everything works correctly and you can see that in variable c there is translated string 'First Second'. But when you will try to run ngx-translate-extract it will shows error:
We cannot extract variable values passed to TranslateService
because into translate.instant you put variable instead of string.
Is there any fix or workaround? I found only that when you use translate['instant'] it will works correctly and not extract it, but it is not elegant solution at all :)
Maybe there will be good feature to create some expected comment like
// ngx-translate-extract prevent-next-line
to prevent next line from beeing extracted.
Hello there,
I'm currently using ngx-translate-extract and found a problem with dynamic translations.
Let's say we have 2 variables
and you want to use final translate string like
const c = '${translate.instant(a)} ${translate.instant(b)}';
Everything works correctly and you can see that in variable c there is translated string 'First Second'. But when you will try to run ngx-translate-extract it will shows error:
We cannot extract variable values passed to TranslateService
because into translate.instant you put variable instead of string.
Is there any fix or workaround? I found only that when you use
translate['instant']
it will works correctly and not extract it, but it is not elegant solution at all :)Maybe there will be good feature to create some expected comment like
// ngx-translate-extract prevent-next-line
to prevent next line from beeing extracted.Kind regards Jan