Parcourir la source

send translation mode in single parameter to _

tags/0.4.0
Ben Cherry il y a 15 ans
Parent
révision
077b7b5eaf
1 fichiers modifiés avec 16 ajouts et 6 suppressions
  1. +16
    -6
      mustache.js

+ 16
- 6
mustache.js Voir le fichier

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


// for each {{_i}}{{/i}} section do... // for each {{_i}}{{/i}} section do...
return html.replace(regex, function(match, content) { 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);
}); });
}, },




Chargement…
Annuler
Enregistrer