i18n-polyfill icon indicating copy to clipboard operation
i18n-polyfill copied to clipboard

feat(extractor): Handle split strings

Open adrienverge opened this issue 5 years ago • 3 comments

Correctly handle concatenations of strings like:

this.i18n('My ' + 'value');

or:

this.i18n({ value: 'My ' + 'value', id: 'myId', description: 'myDescription' });

This is useful for long strings that spread accross multiple lines.

Fixes #45.

adrienverge avatar Feb 18 '19 15:02 adrienverge

Hi @ocombe, any thoughts about this PR? 🙂

It does nothing more than calling _getStringsFromExpression('A') + _getStringsFromExpression('B'), when an expression is A + B.

(And it adds tests.)

adrienverge avatar Feb 27 '19 11:02 adrienverge

Hi @ocombe! Sorry to get on this again... But I think it could be a real improvement for teams that use long strings in their Angular projects 🙂

adrienverge avatar Mar 19 '19 11:03 adrienverge

Hi @ocombe, sorry to get back on this again.

We have to manually patch i18n-polyfill after each npm install (using this PR), otherwise we can't use it on our project (which has split strings like 'part one and ' + 'part two').

Once again, I tried to make the fix very clean (using recursion) and added tests. Is integration conceivable?

EDIT: For reference, I opened a similar pull request at https://github.com/biesbjerg/ngx-translate-extract/pull/122.

adrienverge avatar Apr 12 '19 06:04 adrienverge