i18n-polyfill
i18n-polyfill copied to clipboard
feat(extractor): Handle split strings
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.
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.)
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 🙂
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.