From dfccc0e03458e929a80d85fd57fa62f85774f18d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20B=C3=ADlek?= Date: Mon, 6 Jun 2016 15:44:53 +0200 Subject: [PATCH 1/2] Using first the argument value, then inner HTML May fix https://github.com/rubenv/angular-gettext-tools/issues/146 (not sure). --- lib/extract.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/extract.js b/lib/extract.js index dd8fdca..cea1586 100644 --- a/lib/extract.js +++ b/lib/extract.js @@ -343,7 +343,7 @@ var Extractor = (function () { if (possibleAttributes.indexOf(attr) > -1) { var attrValue = extracted[attr]; str = node.html(); // this shouldn't be necessary, but it is - self.addString(reference(n.startIndex), str || getAttr(attr) || '', attrValue.plural, attrValue.extractedComment, attrValue.context); + self.addString(reference(n.startIndex), getAttr(attr) || str || '', attrValue.plural, attrValue.extractedComment, attrValue.context); } else if (matches = self.noDelimRegex.exec(getAttr(attr))) { str = matches[2].replace(/\\\'/g, '\''); self.addString(reference(n.startIndex), str); From cefd97017dd6355916cd6ea19359eb4b08b0e498 Mon Sep 17 00:00:00 2001 From: Karel Bilek Date: Mon, 6 Jun 2016 16:34:18 +0200 Subject: [PATCH 2/2] Ignoring value in special case Special case
text
should translate "text", not "translate" --- lib/extract.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/extract.js b/lib/extract.js index cea1586..f4b80d0 100644 --- a/lib/extract.js +++ b/lib/extract.js @@ -343,7 +343,15 @@ var Extractor = (function () { if (possibleAttributes.indexOf(attr) > -1) { var attrValue = extracted[attr]; str = node.html(); // this shouldn't be necessary, but it is - self.addString(reference(n.startIndex), getAttr(attr) || str || '', attrValue.plural, attrValue.extractedComment, attrValue.context); + + // slight hack for
text
+ var gotAttr = getAttr(attr); + var isTranslate = attr === 'translate' && gotAttr === 'translate'; + if (isTranslate) { + gotAttr = null; + } + + self.addString(reference(n.startIndex), gotAttr || str || '', attrValue.plural, attrValue.extractedComment, attrValue.context); } else if (matches = self.noDelimRegex.exec(getAttr(attr))) { str = matches[2].replace(/\\\'/g, '\''); self.addString(reference(n.startIndex), str);