diff --git a/lang/default.json b/lang/default.json index ce447e51c5..e5986cd117 100644 --- a/lang/default.json +++ b/lang/default.json @@ -480,9 +480,6 @@ "defaultMessage": "Please log in again.", "description": "OAUTH_TOKEN_INVALID" }, - "6OB9UA": { - "defaultMessage": "Connection error, please come back later" - }, "6OBAOi": { "defaultMessage": "subscribers_empty", "description": "src/views/Circle/Analytics/SubscriberAnalytics/index.tsx" @@ -1036,9 +1033,6 @@ "HBxXD/": { "defaultMessage": "License" }, - "HEpsZ3": { - "defaultMessage": "Back to discovery" - }, "HFVDeB": { "defaultMessage": "Related Tags", "description": "src/views/TagDetail/RelatedTags/index.tsx" @@ -1877,9 +1871,6 @@ "defaultMessage": "subscribers", "description": "src/views/Circle/Analytics/SubscriberAnalytics/index.tsx" }, - "XHcb2q": { - "defaultMessage": "Spaceship maintaining, please come back later" - }, "XOEFDf": { "defaultMessage": "{total} articles" }, @@ -2879,9 +2870,6 @@ "rbrahO": { "defaultMessage": "Close" }, - "rdZi0V": { - "defaultMessage": "It seems you've come to an unknown space, please go back and retry" - }, "rdxgu4": { "defaultMessage": "Email", "description": "src/components/Forms/PaymentForm/ResetPassword/Request.tsx" diff --git a/lang/en.json b/lang/en.json index 5fbdd617ab..3d4e3cfab8 100644 --- a/lang/en.json +++ b/lang/en.json @@ -480,9 +480,6 @@ "defaultMessage": "Please log in again.", "description": "OAUTH_TOKEN_INVALID" }, - "6OB9UA": { - "defaultMessage": "Connection error, please come back later" - }, "6OBAOi": { "defaultMessage": "subscribers_empty", "description": "src/views/Circle/Analytics/SubscriberAnalytics/index.tsx" @@ -1036,9 +1033,6 @@ "HBxXD/": { "defaultMessage": "License" }, - "HEpsZ3": { - "defaultMessage": "Back to discovery" - }, "HFVDeB": { "defaultMessage": "Related Tags", "description": "src/views/TagDetail/RelatedTags/index.tsx" @@ -1877,9 +1871,6 @@ "defaultMessage": "subscribers", "description": "src/views/Circle/Analytics/SubscriberAnalytics/index.tsx" }, - "XHcb2q": { - "defaultMessage": "Spaceship maintaining, please come back later" - }, "XOEFDf": { "defaultMessage": "{total} articles" }, @@ -2879,9 +2870,6 @@ "rbrahO": { "defaultMessage": "Close" }, - "rdZi0V": { - "defaultMessage": "It seems you've come to an unknown space, please go back and retry" - }, "rdxgu4": { "defaultMessage": "Email", "description": "src/components/Forms/PaymentForm/ResetPassword/Request.tsx" diff --git a/lang/zh-Hans.json b/lang/zh-Hans.json index be7b6cf676..6175447a78 100644 --- a/lang/zh-Hans.json +++ b/lang/zh-Hans.json @@ -480,9 +480,6 @@ "defaultMessage": "授权信息已失效,请重新登入", "description": "OAUTH_TOKEN_INVALID" }, - "6OB9UA": { - "defaultMessage": "星球连线出现问题,请稍后看看" - }, "6OBAOi": { "defaultMessage": "目前总订阅人数", "description": "src/views/Circle/Analytics/SubscriberAnalytics/index.tsx" @@ -1036,9 +1033,6 @@ "HBxXD/": { "defaultMessage": "版权声明" }, - "HEpsZ3": { - "defaultMessage": "返回发现" - }, "HFVDeB": { "defaultMessage": "相关标签", "description": "src/views/TagDetail/RelatedTags/index.tsx" @@ -1877,9 +1871,6 @@ "defaultMessage": "人", "description": "src/views/Circle/Analytics/SubscriberAnalytics/index.tsx" }, - "XHcb2q": { - "defaultMessage": "飞船正在检修中,请稍后看看" - }, "XOEFDf": { "defaultMessage": "{total} 篇作品" }, @@ -2879,9 +2870,6 @@ "rbrahO": { "defaultMessage": "关闭" }, - "rdZi0V": { - "defaultMessage": "你似乎遨游到了一个未知空间,请返回重试" - }, "rdxgu4": { "defaultMessage": "请输入邮箱", "description": "src/components/Forms/PaymentForm/ResetPassword/Request.tsx" diff --git a/lang/zh-Hant.json b/lang/zh-Hant.json index c71c1591ce..de339e9412 100644 --- a/lang/zh-Hant.json +++ b/lang/zh-Hant.json @@ -480,9 +480,6 @@ "defaultMessage": "授權信息已失效,請重新登入", "description": "OAUTH_TOKEN_INVALID" }, - "6OB9UA": { - "defaultMessage": "星球連線出現問題,請稍後看看" - }, "6OBAOi": { "defaultMessage": "目前總訂閱人數", "description": "src/views/Circle/Analytics/SubscriberAnalytics/index.tsx" @@ -1036,9 +1033,6 @@ "HBxXD/": { "defaultMessage": "版權聲明" }, - "HEpsZ3": { - "defaultMessage": "返回發現" - }, "HFVDeB": { "defaultMessage": "相關標籤", "description": "src/views/TagDetail/RelatedTags/index.tsx" @@ -1877,9 +1871,6 @@ "defaultMessage": "人", "description": "src/views/Circle/Analytics/SubscriberAnalytics/index.tsx" }, - "XHcb2q": { - "defaultMessage": "飛船正在檢修中,請稍後看看" - }, "XOEFDf": { "defaultMessage": "{total} 篇作品" }, @@ -2879,9 +2870,6 @@ "rbrahO": { "defaultMessage": "關閉" }, - "rdZi0V": { - "defaultMessage": "你似乎遨遊到了一個未知空間,請返回重試" - }, "rdxgu4": { "defaultMessage": "請輸入電子信箱", "description": "src/components/Forms/PaymentForm/ResetPassword/Request.tsx" diff --git a/src/components/Buttons/BackToHome.tsx b/src/components/Buttons/BackToHome.tsx index bcbeca6576..d204977dad 100644 --- a/src/components/Buttons/BackToHome.tsx +++ b/src/components/Buttons/BackToHome.tsx @@ -1,12 +1,25 @@ -import { FormattedMessage } from 'react-intl' +import { useContext } from 'react' import { PATHS } from '~/common/enums' -import { Button, TextIcon } from '~/components' - -export const BackToHomeButton = () => ( - -) +import { Button, LanguageContext, TextIcon } from '~/components' +import { UserLanguage } from '~/gql/graphql' + +export const BackToHomeButton = () => { + const { lang } = useContext(LanguageContext) + + // FIXME: cannot use here cuz it's outer of + const text = + lang === UserLanguage.En + ? 'Back to discovery' + : lang === UserLanguage.ZhHans + ? '返回发现' + : '返回發現' + + return ( + + ) +} diff --git a/src/components/Context/Language/LanguageContext.tsx b/src/components/Context/Language/LanguageContext.tsx index 85dc9e3b3c..40cd79245b 100644 --- a/src/components/Context/Language/LanguageContext.tsx +++ b/src/components/Context/Language/LanguageContext.tsx @@ -1,6 +1,5 @@ import gql from 'graphql-tag' import { createContext, useContext, useEffect, useState } from 'react' -import { FormattedMessage } from 'react-intl' import { COOKIE_LANGUAGE } from '~/common/enums' import { @@ -114,12 +113,13 @@ export const LanguageProvider = ({ }) } catch (e) { toast.error({ - message: ( - - ), + // FIXME: cannot use here cuz it's outer of + message: + language === UserLanguage.En + ? 'Failed to edit, please try again.' + : language === UserLanguage.ZhHans + ? '修改失败,请稍候重试' + : '修改失敗,請稍候重試', }) } } diff --git a/src/components/Error/index.tsx b/src/components/Error/index.tsx index c2837fa616..6f5c60c27c 100644 --- a/src/components/Error/index.tsx +++ b/src/components/Error/index.tsx @@ -1,7 +1,9 @@ import { Alert } from '@reach/alert' -import { FormattedMessage } from 'react-intl' +import { useContext } from 'react' import IMAGE_ILLUSTRATION_EMPTY from '@/public/static/images/illustration-empty.svg' +import { LanguageContext } from '~/components' +import { UserLanguage } from '~/gql/graphql' import styles from './styles.module.css' @@ -13,25 +15,35 @@ interface ErrorProps { message?: string | React.ReactNode } -const ServerError = () => ( - +// FIXME: cannot use here cuz it's outer of +const ServerError = ({ lang }: { lang: UserLanguage }) => ( + <> + {lang === UserLanguage.En + ? 'Spaceship maintaining, please come back later' + : lang === UserLanguage.ZhHans + ? '飞船正在检修中,请稍后看看' + : '飛船正在檢修中,請稍後看看'} + ) -const NetworkError = () => ( - +const NetworkError = ({ lang }: { lang: UserLanguage }) => ( + <> + {lang === UserLanguage.En + ? 'Connection error, please come back later' + : lang === UserLanguage.ZhHans + ? '星球连线出现问题,请稍后看看' + : '星球連線出現問題,請稍後看看'} + ) -const NotFound = () => ( - +const NotFound = ({ lang }: { lang: UserLanguage }) => ( + <> + {lang === UserLanguage.En + ? "It seems you've come to an unknown space, please go back and retry" + : lang === UserLanguage.ZhHans + ? '你似乎遨游到了一个未知空间,请返回重试' + : '你似乎遨遊到了一個未知空間,請返回重試'} + ) export const Error: React.FC> = ({ @@ -40,6 +52,8 @@ export const Error: React.FC> = ({ error, children, }) => { + const { lang } = useContext(LanguageContext) + return (
> = ({ {message ? ( message ) : type === 'not_found' ? ( - + ) : type === 'network' ? ( - + ) : ( - + )}