From a3b4dd03261a84d43a64bae55723ebd7cea6d92e Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 3 Nov 2025 11:33:54 -0600 Subject: [PATCH] Translate Showcase section --- src/components/AppShowcase.tsx | 58 +++++++----------------------- src/lib/i18n.ts | 66 ++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 46 deletions(-) diff --git a/src/components/AppShowcase.tsx b/src/components/AppShowcase.tsx index 2fd021db..e25c0f91 100644 --- a/src/components/AppShowcase.tsx +++ b/src/components/AppShowcase.tsx @@ -14,8 +14,10 @@ import { Skeleton } from "@/components/ui/skeleton"; import { Card, CardContent } from "@/components/ui/card"; import { RelaySelector } from "@/components/RelaySelector"; import { useAppContext } from "@/hooks/useAppContext"; +import { useTranslation } from 'react-i18next'; export function AppShowcase() { + const { t } = useTranslation(); const { user } = useCurrentUser(); const { config } = useAppContext(); const { data: submissions = [], isLoading } = useAppSubmissions(); @@ -33,7 +35,7 @@ export function AppShowcase() { const isModerator = user?.pubkey === MODERATOR_HEX; // Filter and shuffle submissions - memoized with stable dependency - const { templateApps, halloweenApps, featuredApps, approvedApps } = useMemo(() => { + const { templateApps, featuredApps, approvedApps } = useMemo(() => { // Filter visible submissions const visibleSubmissions = submissions.filter(app => !app.isHidden); @@ -41,23 +43,12 @@ export function AppShowcase() { const templates = shuffleArray(visibleSubmissions.filter(app => app.appTags.includes('Template'))); const nonTemplateSubmissions = visibleSubmissions.filter(app => !app.appTags.includes('Template')); - // Get Halloween Hackathon 2025 apps that are featured (for main showcase) - const halloween = shuffleArray(nonTemplateSubmissions.filter(app => - app.appTags.includes('Halloween Hackathon 2025') && app.isFeatured - )); - - // Filter out Halloween Hackathon 2025 apps from other sections (unless featured, they go in Halloween section) - const nonHalloweenSubmissions = nonTemplateSubmissions.filter(app => - !app.appTags.includes('Halloween Hackathon 2025') - ); - // Shuffle featured and approved apps for random display order - const featured = shuffleArray(nonHalloweenSubmissions.filter(app => app.isFeatured)); - const approved = shuffleArray(nonHalloweenSubmissions.filter(app => app.isApproved && !app.isFeatured)); + const featured = shuffleArray(nonTemplateSubmissions.filter(app => app.isFeatured)); + const approved = shuffleArray(nonTemplateSubmissions.filter(app => app.isApproved && !app.isFeatured)); return { templateApps: templates, - halloweenApps: halloween, featuredApps: featured, approvedApps: approved, }; @@ -112,7 +103,7 @@ export function AppShowcase() {

- No apps found. Try another relay? + {t('noAppsFound')}

@@ -134,8 +125,8 @@ export function AppShowcase() { ⭐
-

Featured Apps

-

Handpicked applications showcasing the best of our community

+

{t('featuredApps')}

+

{t('featuredAppsDescription')}

@@ -151,31 +142,6 @@ export function AppShowcase() {
)} - {/* Halloween Hackathon 2025 Apps */} - {halloweenApps.length > 0 && ( -
-
-
- 🎃 -
-
-

Halloween Hackathon 2025

-

Featured spooky creations from our Halloween hackathon

-
-
-
- {halloweenApps.slice(0, 6).map((app) => ( - - ))} -
-
- )} - {/* Templates Section */} {templateApps.length > 0 && (
@@ -184,8 +150,8 @@ export function AppShowcase() { 📋
-

Templates

-

Ready-to-use templates to kickstart your project

+

{t('templates')}

+

{t('templatesDescription')}

@@ -213,10 +179,10 @@ export function AppShowcase() {

- More Apps ({approvedApps.length}) + {t('moreAppsCount', { count: approvedApps.length })}

- {showAllApps ? 'Click to collapse' : 'Click to view more community apps'} + {showAllApps ? t('clickToCollapse') : t('clickToViewMore')}

diff --git a/src/lib/i18n.ts b/src/lib/i18n.ts index 8b0af02c..5dd9f836 100644 --- a/src/lib/i18n.ts +++ b/src/lib/i18n.ts @@ -348,6 +348,17 @@ const resources = { repositoryNotFound: 'Repository not found. Please check the URL and try again.', accessDenied: 'Access denied. The repository may be private or require authentication.', networkError: 'Network error. Please check your connection and try again.', + + // App Showcase + featuredApps: 'Featured Apps', + featuredAppsDescription: 'Handpicked applications showcasing the best of our community', + templates: 'Templates', + templatesDescription: 'Ready-to-use templates to kickstart your project', + moreApps: 'More Apps', + moreAppsCount: 'More Apps ({{count}})', + clickToCollapse: 'Click to collapse', + clickToViewMore: 'Click to view more community apps', + noAppsFound: 'No apps found. Try another relay?', } }, pt: { @@ -693,6 +704,17 @@ const resources = { repositoryNotFound: 'Repositório não encontrado. Verifique a URL e tente novamente.', accessDenied: 'Acesso negado. O repositório pode ser privado ou requer autenticação.', networkError: 'Erro de rede. Verifique sua conexão e tente novamente.', + + // App Showcase + featuredApps: 'Aplicativos em Destaque', + featuredAppsDescription: 'Aplicações selecionadas mostrando o melhor da nossa comunidade', + templates: 'Modelos', + templatesDescription: 'Modelos prontos para usar para iniciar seu projeto', + moreApps: 'Mais Aplicativos', + moreAppsCount: 'Mais Aplicativos ({{count}})', + clickToCollapse: 'Clique para recolher', + clickToViewMore: 'Clique para ver mais aplicativos da comunidade', + noAppsFound: 'Nenhum aplicativo encontrado. Tentar outro relay?', } }, zh: { @@ -1038,6 +1060,17 @@ const resources = { repositoryNotFound: '未找到仓库。请检查URL并重试。', accessDenied: '访问被拒绝。仓库可能是私有的或需要身份验证。', networkError: '网络错误。请检查您的连接并重试。', + + // App Showcase + featuredApps: '精选应用', + featuredAppsDescription: '精选应用展示我们社区的最佳作品', + templates: '模板', + templatesDescription: '即用型模板助您快速启动项目', + moreApps: '更多应用', + moreAppsCount: '更多应用 ({{count}})', + clickToCollapse: '点击折叠', + clickToViewMore: '点击查看更多社区应用', + noAppsFound: '未找到应用。尝试另一个中继?', } }, ha: { @@ -1373,6 +1406,17 @@ const resources = { repositoryNotFound: 'Ba a sami repository ba. Da fatan za a duba URL kuma a sake gwadawa.', accessDenied: 'An hana shiga. Repository na iya zama na sirri ko yana buƙatar tabbatarwa.', networkError: 'Kuskuren hanyar sadarwa. Da fatan za a duba haɗinku kuma a sake gwadawa.', + + // App Showcase + featuredApps: 'Aikace-aikacen da aka Zaɓa', + featuredAppsDescription: 'Aikace-aikacen da aka zaɓa suna nuna mafi kyawun al\'ummarmu', + templates: 'Samfura', + templatesDescription: 'Samfura masu shirye-shirye don fara aikinku', + moreApps: 'Ƙarin Aikace-aikace', + moreAppsCount: 'Ƙarin Aikace-aikace ({{count}})', + clickToCollapse: 'Danna don rufe', + clickToViewMore: 'Danna don ganin ƙarin aikace-aikacen al\'umma', + noAppsFound: 'Ba a sami aikace-aikace ba. Gwada wani relay?', } }, yo: { @@ -1703,6 +1747,17 @@ const resources = { repositoryNotFound: 'Repository ko ri. Jọwọ ṣayẹwo URL ati gbiyanju lẹẹkansi.', accessDenied: 'Wiwọle ni idinamọ. Repository le jẹ ikọkọ tabi nilo ijẹrisi.', networkError: 'Aṣiṣe nẹtiwọọki. Jọwọ ṣayẹwo asopọ rẹ ati gbiyanju lẹẹkansi.', + + // App Showcase + featuredApps: 'Awọn Ohun elo Ti a Yan', + featuredAppsDescription: 'Awọn ohun elo ti a yan n ṣafihan ti o dara julọ ti agbegbe wa', + templates: 'Awọn Awoṣe', + templatesDescription: 'Awọn awoṣe ti o ṣetan lati lo lati bẹrẹ iṣẹ akanṣe rẹ', + moreApps: 'Awọn Ohun elo Diẹ Sii', + moreAppsCount: 'Awọn Ohun elo Diẹ Sii ({{count}})', + clickToCollapse: 'Tẹ lati subu', + clickToViewMore: 'Tẹ lati wo awọn ohun elo agbegbe diẹ sii', + noAppsFound: 'Ko si awọn ohun elo ti a ri. Gbiyanju relay miiran?', } }, ig: { @@ -2033,6 +2088,17 @@ const resources = { repositoryNotFound: 'Ahụghị repository. Biko lelee URL wee nwaa ọzọ.', accessDenied: 'Ajụrụ ohere. Repository nwere ike bụrụ nke nzuzo ma ọ bụ chọrọ nkwenye.', networkError: 'Njehie netwọk. Biko lelee njikọ gị wee nwaa ọzọ.', + + // App Showcase + featuredApps: 'Ngwa Ahọpụtara', + featuredAppsDescription: 'Ngwa ahọpụtara na-egosi nke kacha mma nke obodo anyị', + templates: 'Ụdịdị', + templatesDescription: 'Ụdịdị dị njikere iji jiri malite ọrụ gị', + moreApps: 'Ngwa Ndị Ọzọ', + moreAppsCount: 'Ngwa Ndị Ọzọ ({{count}})', + clickToCollapse: 'Pịa iji gbakọọ', + clickToViewMore: 'Pịa iji hụ ngwa obodo ndị ọzọ', + noAppsFound: 'Ahụghị ngwa ọ bụla. Nwaa relay ọzọ?', } } };