Explorar el Código

send translation mode in single parameter to _

tags/0.4.0
Ben Cherry hace 15 años
padre
commit
077b7b5eaf
Se han modificado 1 ficheros con 16 adiciones y 6 borrados
  1. +16
    -6
      mustache.js

+ 16
- 6
mustache.js Ver fichero

@@ -131,14 +131,24 @@ var Mustache = function() {

// for each {{_i}}{{/i}} section do...
return html.replace(regex, function(match, content) {
var translation_mode;
if (that.pragmas && that.pragmas["TRANSLATION-HINT"] && that.pragmas["TRANSLATION-HINT"]['mode']) {
translation_mode = { _mode: that.pragmas["TRANSLATION-HINT"]['mode'] };
} else if (context['_mode']) {
translation_mode = { _mode: context['_mode'] };
var translationMode;

if (that.pragmas && that.pragmas["TRANSLATION-HINT"] && that.pragmas["TRANSLATION-HINT"].mode) {
translationMode = that.pragmas["TRANSLATION-HINT"].mode;
} else if (context['_TRANSLATION-HINT_mode']) {
translationMode = context['_TRANSLATION-HINT_mode'];
}

var params = content;

if (translationMode) {
params = {
text: content,
mode: translationMode
};
}

return _(content, translation_mode);
return _(params);
});
},



Cargando…
Cancelar
Guardar