Localize drive error message

This commit is contained in:
Made Baruna 2022-06-09 23:23:53 +07:00
parent 735a8271b6
commit 67c4eb95c8
3 changed files with 11 additions and 3 deletions

View file

@ -59,7 +59,7 @@
driveLoading.set(false);
driveError.set(true);
synced.set(true);
pushToast('Drive sync not available right now 😔', 'error');
pushToast($t('common.driveError'), 'error');
}
function handleClientLoad() {
@ -224,7 +224,7 @@
);
} else {
synced.set(true);
pushToast('Data has been synced!');
pushToast($t('common.dataSynced'));
}
} catch (err) {
console.error(err);

View file

@ -879,5 +879,9 @@
},
"radiantSpincrystal": {
"title": "Radiant Spincrystals"
},
"common": {
"dataSynced": "Data has been synced!",
"driveError": "Drive sync not available right now 😔"
}
}

View file

@ -2,6 +2,7 @@ import dayjs from 'dayjs';
import { writable } from 'svelte/store';
import debounce from 'lodash/debounce';
import localforage from 'localforage';
import { t as $t } from 'svelte-i18n';
import { synced, saveId, localModified, lastSyncTime, driveSignedIn } from './dataSync';
import { pushToast } from './toast';
@ -12,6 +13,9 @@ export const fromRemote = writable(false);
export const UPDATE_TIME_KEY = 'update-time';
export const CONVERTED_KEY = 'converted';
let t;
$t.subscribe((f) => (t = f));
let saveFileId = '';
let signedIn = false;
@ -43,7 +47,7 @@ async function saveData(data) {
synced.set(true);
localModified.set(false);
pushToast('Data has been synced!');
pushToast(t('common.dataSynced'));
} catch (err) {
console.error(err);
pushToast('Error when uploading your data!', 'error');