mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-07 22:45:46 +01:00
translate helpers
This commit is contained in:
@@ -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:{}});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user