diff --git a/build/translate.js b/build/translate.js index 28dcf9e..3b8c414 100644 --- a/build/translate.js +++ b/build/translate.js @@ -43,6 +43,9 @@ function translateMessagesToBundle(src, translationsSrc) { function attemptToCreateRenderer(node, message) { if (translations[message]) { + if ((0, _ast.isElementMarker)(node) && bundle[message]) { + return; + } bundle[message] = (0, _translation2.default)(node, translations[message], message); } else { missing[message] = message; diff --git a/src/translate.js b/src/translate.js index 3748ba8..897bd52 100644 --- a/src/translate.js +++ b/src/translate.js @@ -23,6 +23,9 @@ export default function translateMessagesToBundle(src, translationsSrc, {inputFo function attemptToCreateRenderer(node, message) { if (translations[message]) { + if (isElementMarker(node) && bundle[message]) { + return; + } bundle[message] = translatedRendererFor( node, translations[message], diff --git a/test/test-translation.js b/test/test-translation.js index c49b45c..5402f27 100644 --- a/test/test-translation.js +++ b/test/test-translation.js @@ -21,7 +21,8 @@ describe('translation', function() { 'Check out: ': ' "checked" out!', 'opportunities': 'oportunidades', 'You have no items in your cartYou have one item in your cartYou have {this.state.count} items in your cart': - 'No tiene nada in su carritoTiene ún articulo en su carritoTiene {this.state.count} articulos en su carrito' + 'No tiene nada in su carritoTiene ún articulo en su carritoTiene {this.state.count} articulos en su carrito', + 'Hey': 'Hey', }; var expectedResultsForTranslationBundles = { @@ -38,7 +39,8 @@ describe('translation', function() { 'Check out: ': 'function(Component, shnar) { return "checked" out!; }', '': 'function(Re, Ordering) { return ; }', 'You have no items in your cartYou have one item in your cartYou have {this.state.count} items in your cart': - 'function(Pluralize, Match) { return No tiene nada in su carritoTiene ún articulo en su carritoTiene {this.state.count} articulos en su carrito; }' + 'function(Pluralize, Match) { return No tiene nada in su carritoTiene ún articulo en su carritoTiene {this.state.count} articulos en su carrito; }', + 'i18n("Hey");Hey': 'function() { return "Hey"; }', }; Object.keys(expectedResultsForTranslationBundles).forEach(original => {