Hardcoded strings are not translatable
-
Strings ‘d’ and ‘days’ are hardcoded in .js files.
Hours, minutes, and seconds are displayed without leading zero. Please find below a suggested fix. I edited the
do_it()
function and added an utility functionpad()
:function pad(num, size){ return ('00' + num).substr(-size); } function do_it() { timestamp--; var days = component(timestamp, 24 * 60 * 60), hours = component(timestamp, 60 * 60) % 24, minutes = component(timestamp, 60) % 60, seconds = component(timestamp, 1) % 60; if ( curr.hasClass('isb_scheduled_compact') ) { $div.html( ( days !== 0 ? days + '<span>gg</span>' : '' ) + pad(hours) + ':' + pad(minutes) + ':' + pad(seconds)); } else { $div.html( ( days !== 0 ? days + ' giorni, ' : '' ) + pad(hours) + ':' + pad(minutes) + ':' + pad(seconds)); } }
- The topic ‘Hardcoded strings are not translatable’ is closed to new replies.