translate helpers

This commit is contained in:
barisusakli
2014-07-05 16:58:57 -04:00
parent 89acec13dc
commit c5ccf4333b
11 changed files with 35 additions and 46 deletions

View File

@@ -51,6 +51,27 @@ if ('undefined' !== typeof window) {
});
};
$.fn.translateHtml = function(str) {
return translate(this, 'html', str);
};
$.fn.translateText = function(str) {
return translate(this, 'text', str);
};
$.fn.translateVal = function(str) {
return translate(this, 'val', str);
};
function translate(elements, type, str) {
return elements.each(function() {
var el = $(this);
translator.translate(str, function(translated) {
el[type](translated);
});
});
}
})(jQuery || {fn:{}});