Major supplier refactor making the whole system work better
This commit is contained in:
@@ -23,13 +23,13 @@ function t(path, vars){
|
||||
var result, m, translatable, isafety,replacable;
|
||||
var parts = path.split('.');
|
||||
var accessor = '$translations.'+$locale+'["' + parts.join('"]["')+ '"]';
|
||||
try{
|
||||
try{
|
||||
result = eval(accessor);
|
||||
} catch(err){
|
||||
} catch(err){
|
||||
result = parts[parts.length - 1].capitalize();
|
||||
}
|
||||
if(result == '') return '';
|
||||
if(!result) return parts[parts.length - 1].capitalize();
|
||||
if(!result) return parts[parts.length - 1].capitalize();
|
||||
$.each(vars, function(v, value){ result = result.replace('%{'+v+'}', value)});
|
||||
isafety = 0;
|
||||
while(result.indexOf('${') > -1){
|
||||
@@ -62,12 +62,12 @@ function setTranslations(selector){
|
||||
if(selector){
|
||||
$(selector).find('[data-t]').each(function(){$(this).html(t($(this).data('t'), $(this).data('tAttributes')))})
|
||||
$(selector).find('*[data-time]').each(function(){
|
||||
$(this).text(moment($(this).data('time')).format($(this).data('timeFormat') || 'dd D MMM HH:MM'))
|
||||
$(this).text(moment($(this).data('time')).format($(this).data('timeFormat') || 'dd D MMM HH:mm'))
|
||||
})
|
||||
}else{
|
||||
$('[data-t]').each(function(){$(this).html(t($(this).data('t'),$(this).data('tAttributes')))})
|
||||
$('*[data-time]').each(function(){
|
||||
$(this).text(moment($(this).data('time')).format($(this).data('timeFormat') || 'dd D MMM HH:MM'))
|
||||
$(this).text(moment($(this).data('time')).format($(this).data('timeFormat') || 'dd D MMM HH:mm'))
|
||||
})
|
||||
}
|
||||
$('.datepicker').datepicker("option", $.datepicker.regional[$locale])
|
||||
|
||||
Reference in New Issue
Block a user