1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-27 17:00:52 +01:00

i18n auto-reload.js

This commit is contained in:
czaks 2014-10-07 05:40:37 +02:00
parent 9768bb6726
commit ca42984ddc

View File

@ -30,7 +30,7 @@ $(document).ready(function(){
var countdown_interval; var countdown_interval;
// Add an update link // Add an update link
$('.boardlist.bottom').prev().after("<span id='updater'><a href='#' id='update_thread' style='padding-left:10px'>["+_("Update")+"]</a> (<input type='checkbox' id='auto_update_status' checked> Auto) <span id='update_secs'></span></span>"); $('.boardlist.bottom').prev().after("<span id='updater'><a href='#' id='update_thread' style='padding-left:10px'>["+_("Update")+"]</a> (<input type='checkbox' id='auto_update_status' checked> "+_("Auto")+") <span id='update_secs'></span></span>");
// Grab the settings // Grab the settings
var settings = new script_settings('auto-reload'); var settings = new script_settings('auto-reload');
@ -138,7 +138,7 @@ $(document).ready(function(){
var poll = function(manualUpdate) { var poll = function(manualUpdate) {
stop_auto_update(); stop_auto_update();
$('#update_secs').text("Updating..."); $('#update_secs').text(_("Updating..."));
$.ajax({ $.ajax({
url: document.location, url: document.location,
@ -180,15 +180,15 @@ $(document).ready(function(){
} else { } else {
// Decide the message to show if auto update is disabled // Decide the message to show if auto update is disabled
if (loaded_posts > 0) if (loaded_posts > 0)
$('#update_secs').text("Thread updated with "+loaded_posts+" new post(s)"); $('#update_secs').text(fmt(_("Thread updated with {0} new post(s)"), [loaded_posts]));
else else
$('#update_secs').text("No new posts found"); $('#update_secs').text(_("No new posts found"));
} }
}, },
error: function(xhr, status_text, error_text) { error: function(xhr, status_text, error_text) {
if (status_text == "error") { if (status_text == "error") {
if (error_text == "Not Found") { if (error_text == "Not Found") {
$('#update_secs').text("Thread deleted or pruned"); $('#update_secs').text(_("Thread deleted or pruned"));
$('#auto_update_status').prop('checked', false); $('#auto_update_status').prop('checked', false);
$('#auto_update_status').prop('disabled', true); // disable updates if thread is deleted $('#auto_update_status').prop('disabled', true); // disable updates if thread is deleted
return; return;
@ -196,9 +196,9 @@ $(document).ready(function(){
$('#update_secs').text("Error: "+error_text); $('#update_secs').text("Error: "+error_text);
} }
} else if (status_text) { } else if (status_text) {
$('#update_secs').text("Error: "+status_text); $('#update_secs').text(_("Error: ")+status_text);
} else { } else {
$('#update_secs').text("Unknown error"); $('#update_secs').text(_("Unknown error"));
} }
// Keep trying to update // Keep trying to update