From ba6e54d7d5deee3885ef1bc8c9e65cc8eedc88bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Wed, 28 Feb 2024 13:27:10 +0100 Subject: [PATCH] feat: prepare for i18n --- package.json | 2 ++ pnpm-lock.yaml | 24 ++++++++++++++++-- src/lib/ScreenInfo.svelte | 5 ++-- src/lib/i18n.ts | 8 ++++++ src/routes/+layout.svelte | 3 ++- src/routes/+page.svelte | 20 ++++++++------- .../(channels)/channels-5.1/+page.svelte | 13 +++++----- .../(channels)/channels-7.1/+page.svelte | 17 +++++++------ .../audio/(channels)/cycle-button.svelte | 5 ++-- .../audio/(channels)/stereo-test.svelte | 7 +++--- src/routes/audio/+layout.svelte | 3 ++- src/routes/audio/+page.svelte | 13 +++++----- src/routes/audio/phase.svelte | 16 +++++------- src/routes/av-sync/+page.svelte | 3 ++- src/routes/camera/+page.svelte | 25 ++++++++++--------- src/routes/card/+page.svelte | 3 ++- src/routes/gamepad/+page.svelte | 15 +++++------ src/routes/keyboard/+page.svelte | 7 +++--- 18 files changed, 115 insertions(+), 74 deletions(-) create mode 100644 src/lib/i18n.ts diff --git a/package.json b/package.json index c93d349..b23fa59 100644 --- a/package.json +++ b/package.json @@ -43,9 +43,11 @@ "@sveltejs/vite-plugin-svelte": "^3.0.0", "@tabler/icons-webfont": "^2.47.0", "debug": "^4.3.4", + "i18next": "^23.10.0", "lodash": "^4.17.21", "normalize.css": "^8.0.1", "svelte": "^4.2.7", + "svelte-i18next": "^2.2.2", "tslib": "^2.4.1", "typescript": "^5.0.0", "vite": "^5.0.3" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 65c9a26..f95e036 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,6 +26,9 @@ dependencies: debug: specifier: ^4.3.4 version: 4.3.4 + i18next: + specifier: ^23.10.0 + version: 23.10.0 lodash: specifier: ^4.17.21 version: 4.17.21 @@ -35,6 +38,9 @@ dependencies: svelte: specifier: ^4.2.7 version: 4.2.9 + svelte-i18next: + specifier: ^2.2.2 + version: 2.2.2(i18next@23.10.0)(svelte@4.2.9) tslib: specifier: ^2.4.1 version: 2.6.2 @@ -139,7 +145,6 @@ packages: engines: {node: '>=6.9.0'} dependencies: regenerator-runtime: 0.14.1 - dev: true /@esbuild/aix-ppc64@0.19.12: resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==} @@ -1802,6 +1807,12 @@ packages: - supports-color dev: true + /i18next@23.10.0: + resolution: {integrity: sha512-/TgHOqsa7/9abUKJjdPeydoyDc0oTi/7u9F8lMSj6ufg4cbC1Oj3f/Jja7zj7WRIhEQKB7Q4eN6y68I9RDxxGQ==} + dependencies: + '@babel/runtime': 7.23.9 + dev: false + /ieee754@1.2.1: resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} dev: true @@ -2396,7 +2407,6 @@ packages: /regenerator-runtime@0.14.1: resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} - dev: true /require-directory@2.1.1: resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} @@ -2683,6 +2693,16 @@ packages: svelte: 4.2.9 dev: false + /svelte-i18next@2.2.2(i18next@23.10.0)(svelte@4.2.9): + resolution: {integrity: sha512-IpJDZCH5cCgKfHQHgiLmGT4j9HCdg4fqsP3oP2deLu8PxmNj0Ui6khMiDoxAxedAiYEhr0xendv2xqh3Rq+uQQ==} + peerDependencies: + i18next: '*' + svelte: '*' + dependencies: + i18next: 23.10.0 + svelte: 4.2.9 + dev: false + /svelte-preprocess@5.1.3(postcss@8.4.33)(svelte@4.2.9)(typescript@5.3.3): resolution: {integrity: sha512-xxAkmxGHT+J/GourS5mVJeOXZzne1FR5ljeOUAMXUkfEhkLEllRreXpbl3dIYJlcJRfL1LO1uIAPpBpBfiqGPw==} engines: {node: '>= 16.0.0', pnpm: ^8.0.0} diff --git a/src/lib/ScreenInfo.svelte b/src/lib/ScreenInfo.svelte index 4e5e1cb..1656c6c 100644 --- a/src/lib/ScreenInfo.svelte +++ b/src/lib/ScreenInfo.svelte @@ -1,6 +1,7 @@ @@ -63,6 +64,7 @@ & a { text-align: center; text-decoration: none; + white-space: nowrap; &.disabled { pointer-events: none; diff --git a/src/routes/audio/(channels)/channels-5.1/+page.svelte b/src/routes/audio/(channels)/channels-5.1/+page.svelte index fad8203..1a4368b 100644 --- a/src/routes/audio/(channels)/channels-5.1/+page.svelte +++ b/src/routes/audio/(channels)/channels-5.1/+page.svelte @@ -6,19 +6,20 @@ import rearLeftUrl from '@assets/audio/5.1/Rear_Left.mp3'; import rearRightUrl from '@assets/audio/5.1/Rear_Right.mp3'; import LfeUrl from '@assets/audio/5.1/LFE_Noise.mp3'; + import { i18n } from '$lib/i18n';
- Front Left + {$i18n.t('Front Left')}
- Front Center + {$i18n.t('Front Center')}
- Front Right + {$i18n.t('Front Right')}
- Rear Left - Rear Right + {$i18n.t('Rear Left')} + {$i18n.t('Rear Right')}
-LFE +{$i18n.t('LFE')}
5.1
diff --git a/src/routes/audio/(channels)/channels-7.1/+page.svelte b/src/routes/audio/(channels)/channels-7.1/+page.svelte index d37afd5..031f7a2 100644 --- a/src/routes/audio/(channels)/channels-7.1/+page.svelte +++ b/src/routes/audio/(channels)/channels-7.1/+page.svelte @@ -8,24 +8,25 @@ import rearLeftUrl from '@assets/audio/7.1/Rear_Left.mp3'; import rearRightUrl from '@assets/audio/7.1/Rear_Right.mp3'; import LfeUrl from '@assets/audio/7.1/LFE_Noise.mp3'; + import { i18n } from '$lib/i18n';
- Front Left + {$i18n.t('Front Left')}
- Front Center + {$i18n.t('Front Center')}
- Front Right + {$i18n.t('Front Right')}
- Side Left - Side Right + {$i18n.t('Side Left')} + {$i18n.t('Side Right')}
- Rear Left - Rear Right + {$i18n.t('Rear Left')} + {$i18n.t('Rear Right')}
-LFE +{$i18n.t('LFE')}
7.1
diff --git a/src/routes/audio/(channels)/cycle-button.svelte b/src/routes/audio/(channels)/cycle-button.svelte index 0078e6b..e839b97 100644 --- a/src/routes/audio/(channels)/cycle-button.svelte +++ b/src/routes/audio/(channels)/cycle-button.svelte @@ -1,5 +1,6 @@
- Left - Center - Right + {$i18n.t('Left')} + {$i18n.t('Center')} + {$i18n.t('Right')}
diff --git a/src/routes/audio/+layout.svelte b/src/routes/audio/+layout.svelte index 4d17672..b37c15a 100644 --- a/src/routes/audio/+layout.svelte +++ b/src/routes/audio/+layout.svelte @@ -1,5 +1,6 @@ -

Audio test

+

{$i18n.t('Audio test')}

diff --git a/src/routes/audio/+page.svelte b/src/routes/audio/+page.svelte index 2f42fe0..2bdefed 100644 --- a/src/routes/audio/+page.svelte +++ b/src/routes/audio/+page.svelte @@ -1,22 +1,23 @@ diff --git a/src/routes/audio/phase.svelte b/src/routes/audio/phase.svelte index 87900cc..2cecbd0 100644 --- a/src/routes/audio/phase.svelte +++ b/src/routes/audio/phase.svelte @@ -1,5 +1,6 @@ -

Audio/Video Synchronization

+

{$i18n.t('Audio/Video Synchronization')}