瀏覽代碼

send translation mode in single parameter to _

tags/0.4.0
Ben Cherry 15 年之前
父節點
當前提交
077b7b5eaf
共有 1 個檔案被更改,包括 16 行新增6 行删除
  1. +16
    -6
      mustache.js

+ 16
- 6
mustache.js 查看文件

@@ -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);
});
},



Loading…
取消
儲存