fix(i18n): prepare for Lokalise
This commit is contained in:
@@ -5,6 +5,7 @@ import { getProfile } from "@/lib/trpc/memoizedRequests"
|
||||
|
||||
import AccountPage from "@/components/Webviews/AccountPage"
|
||||
import LoyaltyPage from "@/components/Webviews/LoyaltyPage"
|
||||
import { getIntl } from "@/i18n"
|
||||
import { setLang } from "@/i18n/serverContext"
|
||||
|
||||
import type {
|
||||
@@ -18,11 +19,12 @@ export default async function ContentTypePage({
|
||||
params,
|
||||
}: PageArgs<LangParams & ContentTypeWebviewParams & UIDParams, {}>) {
|
||||
setLang(params.lang)
|
||||
const intl = await getIntl()
|
||||
const user = await getProfile()
|
||||
|
||||
if (!user) {
|
||||
console.log(`[webview:page] unable to load user`)
|
||||
return <p>Error: No user could be loaded</p>
|
||||
return <p>{intl.formatMessage({ id: "Error: No user could be loaded" })}</p>
|
||||
}
|
||||
|
||||
if ("error" in user) {
|
||||
@@ -36,9 +38,13 @@ export default async function ContentTypePage({
|
||||
console.log(`[webview:page] user error, redirecting to: ${redirectURL}`)
|
||||
redirect(redirectURL)
|
||||
case "notfound":
|
||||
return <p>Error: user not found</p>
|
||||
return <p>{intl.formatMessage({ id: "Error: user not found" })}</p>
|
||||
case "unknown":
|
||||
return <p>Unknown error occurred loading user</p>
|
||||
return (
|
||||
<p>
|
||||
{intl.formatMessage({ id: "Unknown error occurred loading user" })}
|
||||
</p>
|
||||
)
|
||||
default:
|
||||
const u: never = user
|
||||
console.log(`[webview:page] unhandled user loading error`)
|
||||
|
||||
Reference in New Issue
Block a user