1
1
import { pick } from "lodash"
2
2
import { notFound } from "next/navigation"
3
- import { getMessages , setRequestLocale } from "next-intl/server"
3
+ import {
4
+ getMessages ,
5
+ getTranslations ,
6
+ setRequestLocale ,
7
+ } from "next-intl/server"
4
8
5
9
import { ChainName } from "@/lib/types"
6
10
@@ -58,6 +62,9 @@ const Page = async ({
58
62
const { locale, application } = await params
59
63
setRequestLocale ( locale )
60
64
65
+ // Get translations
66
+ const t = await getTranslations ( { locale, namespace : "page-apps" } )
67
+
61
68
// Get i18n messages
62
69
const allMessages = await getMessages ( { locale } )
63
70
const requiredNamespaces = getRequiredNamespacesForPage ( "/apps" )
@@ -115,9 +122,9 @@ const Page = async ({
115
122
const diffInMs = now . getTime ( ) - date . getTime ( )
116
123
const diffInDays = Math . floor ( diffInMs / ( 1000 * 60 * 60 * 24 ) )
117
124
118
- if ( diffInDays === 0 ) return "Today"
119
- if ( diffInDays === 1 ) return "1 day ago"
120
- return ` ${ diffInDays } days ago`
125
+ if ( diffInDays === 0 ) return t ( "page-apps-today" )
126
+ if ( diffInDays === 1 ) return t ( "page-apps-one- day- ago")
127
+ return t ( "page-apps-days-ago" , { days : diffInDays } )
121
128
}
122
129
123
130
return (
@@ -194,7 +201,7 @@ const Page = async ({
194
201
eventName : "visit" ,
195
202
} }
196
203
>
197
- Visit { app . name }
204
+ { t ( "page-apps-visit-app" , { appName : app . name } ) }
198
205
</ ButtonLink >
199
206
< div className = "flex flex-row justify-between gap-4" >
200
207
< div className = "flex h-fit flex-row flex-wrap gap-4" >
@@ -250,7 +257,9 @@ const Page = async ({
250
257
{ nextApp && (
251
258
< LinkBox className = "group flex flex-row items-center rounded-lg hover:bg-background-highlight sm:hidden" >
252
259
< div className = "mr-2 flex flex-col text-right" >
253
- < p className = "text-sm text-gray-500" > See next</ p >
260
+ < p className = "text-sm text-gray-500" >
261
+ { t ( "page-apps-see-next" ) }
262
+ </ p >
254
263
< p className = "text-primary group-hover:text-primary-hover" >
255
264
{ nextApp . name }
256
265
</ p >
@@ -275,7 +284,9 @@ const Page = async ({
275
284
{ nextApp && (
276
285
< LinkBox className = "group hidden flex-row items-center rounded-lg p-3 hover:bg-background-highlight sm:flex" >
277
286
< div className = "mr-2 flex flex-col text-right" >
278
- < p className = "text-nowrap text-sm text-gray-500" > See next</ p >
287
+ < p className = "text-nowrap text-sm text-gray-500" >
288
+ { t ( "page-apps-see-next" ) }
289
+ </ p >
279
290
< p className = "text-primary group-hover:text-primary-hover" >
280
291
{ nextApp . name }
281
292
</ p >
@@ -299,25 +310,31 @@ const Page = async ({
299
310
< div className = "grid grid-cols-1 grid-rows-[auto_1fr] gap-10 bg-background-highlight px-4 py-10 md:grid-cols-[minmax(0,1fr)_auto] md:px-8" >
300
311
< p className = "max-w-3xl" > { app . description } </ p >
301
312
< div className = "flex h-fit w-full flex-col gap-4 rounded-2xl border bg-background p-8 md:row-span-2 md:w-44" >
302
- < h3 className = "text-lg" > Info </ h3 >
313
+ < h3 className = "text-lg" > { t ( "page-apps-info-title" ) } </ h3 >
303
314
< div >
304
- < p className = "text-sm text-body-medium" > Founded</ p >
315
+ < p className = "text-sm text-body-medium" >
316
+ { t ( "page-apps-info-founded" ) }
317
+ </ p >
305
318
< p className = "text-sm" >
306
319
{ new Date ( app . dateOfLaunch ) . getFullYear ( ) }
307
320
</ p >
308
321
</ div >
309
322
< div >
310
- < p className = "text-sm text-body-medium" > Creator</ p >
323
+ < p className = "text-sm text-body-medium" >
324
+ { t ( "page-apps-info-creator" ) }
325
+ </ p >
311
326
< p className = "text-sm" > { app . parentCompany } </ p >
312
327
</ div >
313
328
< div >
314
- < p className = "text-sm text-body-medium" > Last updated</ p >
329
+ < p className = "text-sm text-body-medium" >
330
+ { t ( "page-apps-info-last-updated" ) }
331
+ </ p >
315
332
< p className = "text-sm" > { getTimeAgo ( app . lastUpdated ) } </ p >
316
333
</ div >
317
334
</ div >
318
335
{ app . screenshots . length > 0 && (
319
336
< div className = "flex flex-col gap-4" >
320
- < h3 className = "text-2xl" > Gallery </ h3 >
337
+ < h3 className = "text-2xl" > { t ( "page-apps-gallery-title" ) } </ h3 >
321
338
< ScreenshotSwiper
322
339
screenshots = { app . screenshots }
323
340
appName = { app . name }
@@ -329,7 +346,7 @@ const Page = async ({
329
346
{ relatedApps . length > 0 && (
330
347
< div className = "flex flex-col px-4 py-10 md:px-8" >
331
348
< div className = "flex w-full flex-col items-center gap-8 rounded-2xl bg-gradient-to-t from-blue-500/20 from-10% to-blue-500/5 to-90% p-12 px-4 md:px-8" >
332
- < h2 > More apps like this</ h2 >
349
+ < h2 > { t ( "page- apps-more-apps- like- this" ) } </ h2 >
333
350
< div className = "flex w-full flex-col gap-4 lg:flex-row" >
334
351
{ relatedApps . map ( ( relatedApp ) => (
335
352
< div
0 commit comments