rubenv/angular-gettext-tools

Only first of consecutive attributes gets extracted.

Opened this issue · 0 comments

Given two consecutive attributes in a DOM node, only the first one gets extracted.

For example in the following div only string1 will get extracted:

<div attribute1="'string1'|translate" attribute2="'string2'|translate">
</div>

However if there is a non matching attribute between, it works as expected:

<div attribute1="'string1'|translate" class="test" attribute2="'string2'|translate">
</div>

This is due to the RegExp used inside extract.js and can be fixed by resetting lastIndex on line 311ff:

str = matches[2].replace(/\\\'/g, '\'');
self.addString(reference(n.startIndex), str);
noDelimRegex.lastIndex = 0;