fix: Google Drive translatability

This commit is contained in:
barredterra 2024-01-23 20:13:34 +01:00
parent 482334861d
commit bb7bb41621
2 changed files with 7 additions and 6 deletions

View file

@ -13,13 +13,14 @@ frappe.ui.form.on("Google Drive", {
frappe.realtime.on("upload_to_google_drive", (data) => {
if (data.progress) {
const progress_title = __("Uploading to Google Drive");
frm.dashboard.show_progress(
"Uploading to Google Drive",
progress_title,
(data.progress / data.total) * 100,
__("{0}", [data.message])
data.message
);
if (data.progress === data.total) {
frm.dashboard.hide_progress("Uploading to Google Drive");
frm.dashboard.hide_progress(progress_title);
}
}
});

View file

@ -170,7 +170,7 @@ def upload_system_backup_to_google_drive():
validate_file_size()
if frappe.flags.create_new_backup:
set_progress(1, "Backing up Data.")
set_progress(1, _("Backing up Data."))
backup = new_backup()
file_urls = []
file_urls.append(backup.backup_path_db)
@ -196,12 +196,12 @@ def upload_system_backup_to_google_drive():
frappe.throw(_("Google Drive - Could not locate - {0}").format(e))
try:
set_progress(2, "Uploading backup to Google Drive.")
set_progress(2, _("Uploading backup to Google Drive."))
google_drive.files().create(body=file_metadata, media_body=media, fields="id").execute()
except HttpError as e:
send_email(False, "Google Drive", "Google Drive", "email", error_status=e)
set_progress(3, "Uploading successful.")
set_progress(3, _("Uploading successful."))
frappe.db.set_single_value("Google Drive", "last_backup_on", frappe.utils.now_datetime())
send_email(True, "Google Drive", "Google Drive", "email")
return _("Google Drive Backup Successful.")