From 209ae88a0e7b5546765c15743b482179520d293e Mon Sep 17 00:00:00 2001 From: Florian <45694132+flo-bit@users.noreply.github.com> Date: Tue, 19 Nov 2024 05:11:16 +0100 Subject: [PATCH] add language selection to trending hashtags --- src/routes/trending/+page.svelte | 68 ++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 4 deletions(-) diff --git a/src/routes/trending/+page.svelte b/src/routes/trending/+page.svelte index 2b9087c..03ca435 100644 --- a/src/routes/trending/+page.svelte +++ b/src/routes/trending/+page.svelte @@ -48,7 +48,8 @@ json.commit.collection === 'app.bsky.feed.post' && json.commit.operation === 'create' && json.commit.record.text && - (!json.commit.record.langs || json.commit.record.langs.includes('en')) + (json.commit.record.langs?.includes(languageCode) || + (!json.commit.record.langs && languageCode === 'en')) ) { // get text of post const text: string = json.commit.record.text; @@ -117,10 +118,37 @@ .slice(0, num); return mostPopular; } + + const languages = [ + { value: 'en', label: 'English' }, + { value: 'zh', label: 'Mandarin Chinese' }, + { value: 'hi', label: 'Hindi' }, + { value: 'es', label: 'Spanish' }, + { value: 'ar', label: 'Arabic' }, + { value: 'bn', label: 'Bengali' }, + { value: 'fr', label: 'French' }, + { value: 'ru', label: 'Russian' }, + { value: 'pt', label: 'Portuguese' }, + { value: 'id', label: 'Indonesian' }, + { value: 'ur', label: 'Urdu' }, + { value: 'ja', label: 'Japanese' }, + { value: 'de', label: 'German' }, + { value: 'ko', label: 'Korean' }, + { value: 'vi', label: 'Vietnamese' }, + { value: 'tr', label: 'Turkish' }, + { value: 'it', label: 'Italian' }, + { value: 'pl', label: 'Polish' }, + { value: 'uk', label: 'Ukrainian' }, + { value: 'nl', label: 'Dutch' } + ]; + + let showLanguageSelector = false; + + let languageCode = 'en'; + let language = 'English'; -