From f6ff5156b66efbb51ba046e37de65b466585124a Mon Sep 17 00:00:00 2001 From: secondl1ght <85003930+secondl1ght@users.noreply.github.com> Date: Wed, 24 Aug 2022 19:51:31 -0400 Subject: remove duplicate elements and format --- src/components/About.svelte | 18 ++++++----- src/lib/translations/index.js | 46 ++++++++++++---------------- src/routes/+layout.svelte | 4 +-- src/routes/[username]/dashboard/+page.svelte | 13 -------- src/routes/invoice/+server.js | 2 +- src/routes/invoice/[id]/+page.server.js | 1 - 6 files changed, 33 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/components/About.svelte b/src/components/About.svelte index 3cd25f8c..55fc34d1 100644 --- a/src/components/About.svelte +++ b/src/components/About.svelte @@ -54,14 +54,16 @@ - +
diff --git a/src/lib/translations/index.js b/src/lib/translations/index.js index dc03c0b6..2b1f2481 100644 --- a/src/lib/translations/index.js +++ b/src/lib/translations/index.js @@ -3,42 +3,36 @@ import lang from './lang.json'; // setup loaders & translations from lang.json data function createLocaleLoader(localeCode) { - return { - locale: localeCode, - key: '', - loader: async () => ( - await import(`../../locales/${localeCode}.json`) - ).default - }; + return { + locale: localeCode, + key: '', + loader: async () => (await import(`../../locales/${localeCode}.json`)).default + }; } const availableLocales = Object.keys(lang); const translations = {}; for (let i = 0; i < availableLocales.length; i++) { - translations[availableLocales[i]] = { lang }; + translations[availableLocales[i]] = { lang }; } const loaders = availableLocales.map(createLocaleLoader); const config = { initLocale: 'en', - fallbackLocale: 'en', - translations: translations, - loaders: [ - { - locale: 'en', - key: '', - loader: async () => ( - await import("../../locales/en.json") - ).default - }, - { - locale: 'fr', - key: '', - loader: async () => ( - await import("../../locales/fr.json") - ).default - } - ] + fallbackLocale: 'en', + translations: translations, + loaders: [ + { + locale: 'en', + key: '', + loader: async () => (await import('../../locales/en.json')).default + }, + { + locale: 'fr', + key: '', + loader: async () => (await import('../../locales/fr.json')).default + } + ] }; export const { t, l, locales, locale } = new i18n(config); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 5eab20bd..3309393e 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -11,7 +11,7 @@ import { warning, protectedRoutes } from '$lib/utils'; import { t, locale } from '$lib/translations'; - const localeLocalStorageKey = 'sveltekit-i18n-locale'; + const localeLocalStorageKey = 'sveltekit-i18n-locale'; $: $token = data.token; @@ -21,7 +21,7 @@ $: $selectedRate = data.user && $rate * (data.rates[data.user.currency] / data.rates.USD); onMount(() => { - let localStorageLocale = localStorage.getItem(localeLocalStorageKey); + let localStorageLocale = localStorage.getItem(localeLocalStorageKey); if (localStorageLocale) locale.set(localStorageLocale); locale.subscribe((lng) => { diff --git a/src/routes/[username]/dashboard/+page.svelte b/src/routes/[username]/dashboard/+page.svelte index e4f6538e..969717df 100644 --- a/src/routes/[username]/dashboard/+page.svelte +++ b/src/routes/[username]/dashboard/+page.svelte @@ -110,19 +110,6 @@ : 'opacity-100'} rounded-2xl border py-3 font-bold w-full mt-2 bg-black text-white" on:click={withdraw}>{$t('user.dashboard.send')} - -
- -