From c4c135ba785954b0f54129b8fe688ebbdd2b65d9 Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Fri, 8 Jul 2022 17:14:11 +0800 Subject: [PATCH 1/2] fix(console): docs link in get-started should be localized --- packages/console/src/pages/GetStarted/hook.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/console/src/pages/GetStarted/hook.ts b/packages/console/src/pages/GetStarted/hook.ts index 604c5126649..f7b16d09046 100644 --- a/packages/console/src/pages/GetStarted/hook.ts +++ b/packages/console/src/pages/GetStarted/hook.ts @@ -1,7 +1,9 @@ import { AdminConsoleKey, I18nKey } from '@logto/phrases'; import { AppearanceMode, Application } from '@logto/schemas'; import { demoAppApplicationId } from '@logto/schemas/lib/seeds'; +import { conditionalString } from '@silverhand/essentials'; import { useMemo } from 'react'; +import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; import useSWR from 'swr'; @@ -33,6 +35,9 @@ type GetStartedMetadata = { }; const useGetStartedMetadata = () => { + const { + i18n: { language }, + } = useTranslation(); const { settings, updateSettings } = useSettings(); const theme = useTheme(); const isLightMode = theme === AppearanceMode.LightMode; @@ -120,7 +125,12 @@ const useGetStartedMetadata = () => { isComplete: settings?.furtherReadingsChecked, onClick: () => { void updateSettings({ furtherReadingsChecked: true }); - window.open('https://docs.logto.io/', '_blank'); + window.open( + `https://docs.logto.io/${conditionalString( + language !== 'en' && language.toLowerCase() + )}`, + '_blank' + ); }, }, ]; @@ -129,6 +139,7 @@ const useGetStartedMetadata = () => { }, [ hideDemo, isLightMode, + language, navigate, settings?.applicationCreated, settings?.demoChecked, From 468aeaed1127366d2b7f06794aa687a2015c5e38 Mon Sep 17 00:00:00 2001 From: Charles Zhao Date: Fri, 8 Jul 2022 17:18:07 +0800 Subject: [PATCH 2/2] fix: further reading link Co-authored-by: Gao Sun --- packages/console/src/pages/GetStarted/hook.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/console/src/pages/GetStarted/hook.ts b/packages/console/src/pages/GetStarted/hook.ts index f7b16d09046..153205f9394 100644 --- a/packages/console/src/pages/GetStarted/hook.ts +++ b/packages/console/src/pages/GetStarted/hook.ts @@ -128,7 +128,7 @@ const useGetStartedMetadata = () => { window.open( `https://docs.logto.io/${conditionalString( language !== 'en' && language.toLowerCase() - )}`, + )}/docs/tutorials/get-started/further-readings`, '_blank' ); },