This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/initializers/verbose-localization.js.es6
2014-08-27 14:12:11 +10:00

26 lines
676 B
JavaScript

export default {
name: 'verbose-localization',
initialize: function() {
if(Discourse.SiteSettings.verbose_localization){
var counter = 0;
var keys = {};
var t = I18n.t;
I18n.t = I18n.translate = function(scope, value){
var current = keys[scope];
if(!current) {
current = keys[scope] = ++counter;
var message = "Translation #" + current + ": " + scope;
if (!_.isEmpty(value)) {
message += ", parameters: " + JSON.stringify(value);
}
window.console.log(message);
}
return t.apply(I18n, [scope, value]) + " (t" + current + ")";
};
}
}
};