diff --git a/src/components/DataSync.svelte b/src/components/DataSync.svelte index 8b9cf506..626a6c97 100644 --- a/src/components/DataSync.svelte +++ b/src/components/DataSync.svelte @@ -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); diff --git a/src/locales/en.json b/src/locales/en.json index 0c2ab21f..f636f11e 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -879,5 +879,9 @@ }, "radiantSpincrystal": { "title": "Radiant Spincrystals" + }, + "common": { + "dataSynced": "Data has been synced!", + "driveError": "Drive sync not available right now 😔" } } \ No newline at end of file diff --git a/src/stores/saveManager.js b/src/stores/saveManager.js index de0d8f58..a975b6de 100644 --- a/src/stores/saveManager.js +++ b/src/stores/saveManager.js @@ -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');