Browse Source

160341-182636 change link up to language

mariko-h 3 weeks ago
parent
commit
baf41766db

+ 7 - 3
apps/app/src/client/components/PageEditor/EditorGuideModal/contents/TextStyleTab.tsx

@@ -5,6 +5,8 @@ import { PrismAsyncLight } from 'react-syntax-highlighter';
 import { oneDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';
 
 import { toastError, toastSuccess } from '~/client/util/toastr';
+import { useGrowiDocumentationUrl } from '~/states/context';
+import { getLocale } from '~/utils/locale-utils';
 
 import styles from './TextStyleTab.module.scss';
 
@@ -64,7 +66,9 @@ const GuideRow = ({
 };
 
 export const TextStyleTab: React.FC = () => {
-  const { t } = useTranslation();
+  const { t, i18n } = useTranslation();
+  const documentationUrl = useGrowiDocumentationUrl();
+  const docsLang = getLocale(i18n.language).code === 'ja' ? 'ja' : 'en';
   const i18nKey = 'editor_guide.textstyle';
 
   const TEXT_STYLE_GUIDES = [
@@ -170,10 +174,10 @@ export const TextStyleTab: React.FC = () => {
     {
       id: 'link-docs',
       title: t(`${i18nKey}.link_label`),
-      code: `[${t(`${i18nKey}.link_docs`)}](https://docs.growi.org/ja/g)`,
+      code: `[${t(`${i18nKey}.link_docs`)}](${documentationUrl}/${docsLang})`,
       preview: (
         <a
-          href="https://docs.growi.org/ja/g"
+          href={`${documentationUrl}/${docsLang}`}
           target="_blank"
           rel="noreferrer"
           className="text-secondary text-decoration-underline"