From a1a9bd7e08397e7a98a33a249024b6a2e7e08b36 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Wed, 31 Jan 2024 08:09:40 -0800 Subject: feat(locale): localise birthdays --- src/lib/Locale/english.ts | 8 ++++++++ src/lib/Locale/japanese.ts | 8 ++++++++ src/lib/Locale/layout.ts | 8 ++++++++ src/lib/Tools/Picker.svelte | 3 ++- src/lib/Tools/tools.ts | 31 +++++++++++++++++++++---------- src/routes/+layout.svelte | 4 +++- src/routes/tools/+page.svelte | 4 ++-- src/routes/tools/[tool]/+page.svelte | 2 +- 8 files changed, 53 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/lib/Locale/english.ts b/src/lib/Locale/english.ts index b1f5f9ea..92a1f608 100644 --- a/src/lib/Locale/english.ts +++ b/src/lib/Locale/english.ts @@ -187,6 +187,14 @@ const English: Locale = { hint: 'Concluded manga and light novels that you have not read all available chapters of' } } + }, + tools: { + tool: { + characterBirthdays: { + short: 'Character Birthdays', + long: "Today's Character Birthdays" + } + } } }; diff --git a/src/lib/Locale/japanese.ts b/src/lib/Locale/japanese.ts index 105b4b9b..2deccb45 100644 --- a/src/lib/Locale/japanese.ts +++ b/src/lib/Locale/japanese.ts @@ -189,6 +189,14 @@ const Japanese: Locale = { hint: '完結したマンガ&ライトノベルで、全章を読んでいないもの' } } + }, + tools: { + tool: { + characterBirthdays: { + short: 'キャラクターの誕生日', + long: '今日のキャラクターの誕生日' + } + } } }; diff --git a/src/lib/Locale/layout.ts b/src/lib/Locale/layout.ts index c2ecc94c..00c19ea9 100644 --- a/src/lib/Locale/layout.ts +++ b/src/lib/Locale/layout.ts @@ -192,4 +192,12 @@ export interface Locale { }; }; }; + tools: { + tool: { + characterBirthdays: { + short: LocaleValue; + long: LocaleValue; + }; + }; + }; } diff --git a/src/lib/Tools/Picker.svelte b/src/lib/Tools/Picker.svelte index b60a7039..cfc5c065 100644 --- a/src/lib/Tools/Picker.svelte +++ b/src/lib/Tools/Picker.svelte @@ -2,6 +2,7 @@ import { browser } from '$app/environment'; import { goto } from '$app/navigation'; import root from '$lib/Utility/root'; + import locale from '$stores/locale'; export let tool: string; @@ -15,7 +16,7 @@ > - + diff --git a/src/lib/Tools/tools.ts b/src/lib/Tools/tools.ts index 96aaeb47..2191243e 100644 --- a/src/lib/Tools/tools.ts +++ b/src/lib/Tools/tools.ts @@ -1,48 +1,59 @@ -export const tools: { [key: string]: { name: string; description?: string; id: string } } = { +import locale from '$stores/locale'; +import { get } from 'svelte/store'; + +export const tools: { + [key: string]: { + name: () => string; + description?: string; + id: string; + }; +} = { default: { - name: 'Tools', + name: () => 'Tools', description: 'A collection of tools to help you get the most out of AniList.', id: 'default' }, wrapped: { - name: 'AniList Wrapped & Statistics Panel', + name: () => 'AniList Wrapped & Statistics Panel', description: 'Instantly generate an AniList themed Wrapped for your profile, doubling as a statistics panel for your bio', id: 'wrapped' }, birthdays: { - name: "Today's Character Birthdays", + name: () => { + return get(locale)().tools.tool.characterBirthdays.long; + }, description: 'Find and display the birthdays of all characters for today, or any other day of the year', id: 'birthdays' }, sequel_spy: { - name: 'Sequel Spy (Missing Prequel Finder)', + name: () => 'Sequel Spy (Missing Prequel Finder)', description: "Find media with prequels you haven't seen yet for any given simulcast season", id: 'sequel_spy' }, discussions: { - name: 'Episode Discussion Collector', + name: () => 'Episode Discussion Collector', description: 'Find and display all episode discussions for a given user', id: 'discussions' }, random_follower: { - name: 'Random Follower Finder', + name: () => 'Random Follower Finder', description: 'Find a random follower of any given user', id: 'random_follower' }, likes: { - name: 'Likes', + name: () => 'Likes', description: 'Get All Likes of an Activity or Forum Thread', id: 'likes' }, dump_profile: { - name: 'Dump Profile', + name: () => 'Dump Profile', description: "Dump a user's profile to JSON", id: 'dump_profile' }, activity_history: { - name: 'Activity History Analyser', + name: () => 'Activity History Analyser', id: 'activity_history' } }; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 6d57ff78..a29529d7 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -116,7 +116,9 @@ {$locale().navigation.subtitleSchedule} {$locale().navigation.newReleases} - Character Birthdays + + {$locale().tools.tool.characterBirthdays.short} + {$locale().navigation.tools} diff --git a/src/routes/tools/+page.svelte b/src/routes/tools/+page.svelte index edc18410..6dac37ec 100644 --- a/src/routes/tools/+page.svelte +++ b/src/routes/tools/+page.svelte @@ -9,7 +9,7 @@ - +

Select a tool to continue.

@@ -18,7 +18,7 @@ {#each Object.keys(tools) as t} {#if t !== 'default'}
  • - (tool = t)}>{tools[t].name} + (tool = t)}>{tools[t].name()} {#if tools[t].description}
    {tools[t].description}
    {/if} diff --git a/src/routes/tools/[tool]/+page.svelte b/src/routes/tools/[tool]/+page.svelte index e6f151ad..137df74d 100644 --- a/src/routes/tools/[tool]/+page.svelte +++ b/src/routes/tools/[tool]/+page.svelte @@ -45,7 +45,7 @@
  • {:else} - + {#if tool === 'activity_history'} -- cgit v1.2.3