Преглед изворни кода

fix: use existing getLocale instead of new getDocumentationLocale

Address review feedback: use getLocale().code from locale-utils
instead of introducing a new helper function.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
VANELLOPE\tomoyuki-t пре 5 дана
родитељ
комит
8fc4c33327
2 измењених фајлова са 2 додато и 13 уклоњено
  1. 2 2
      apps/app/src/client/components/PageCreateModal.tsx
  2. 0 11
      apps/app/src/utils/locale-utils.ts

+ 2 - 2
apps/app/src/client/components/PageCreateModal.tsx

@@ -28,7 +28,7 @@ import {
   usePageCreateModalActions,
   usePageCreateModalActions,
   usePageCreateModalStatus,
   usePageCreateModalStatus,
 } from '~/states/ui/modal/page-create';
 } from '~/states/ui/modal/page-create';
-import { getDocumentationLocale } from '~/utils/locale-utils';
+import { getLocale } from '~/utils/locale-utils';
 
 
 import PagePathAutoComplete from './PagePathAutoComplete';
 import PagePathAutoComplete from './PagePathAutoComplete';
 
 
@@ -74,7 +74,7 @@ const PageCreateModal: React.FC = () => {
     [userHomepagePath, t, now],
     [userHomepagePath, t, now],
   );
   );
 
 
-  const docsLang = getDocumentationLocale(i18n.language);
+  const docsLang = getLocale(i18n.language).code === 'ja' ? 'ja' : 'en';
   const templateHelpUrl = `${documentationUrl}/${docsLang}/guide/features/template.html`;
   const templateHelpUrl = `${documentationUrl}/${docsLang}/guide/features/template.html`;
 
 
   const [todayInput, setTodayInput] = useState('');
   const [todayInput, setTodayInput] = useState('');

+ 0 - 11
apps/app/src/utils/locale-utils.ts

@@ -42,14 +42,3 @@ export const getLocale = (langCode: string): Locale => {
 
 
   return locale ?? enUS;
   return locale ?? enUS;
 };
 };
-
-/**
- * Gets the documentation site language code from an i18next language code.
- * Only 'ja' and 'en' are supported on the GROWI documentation site.
- * @param langCode The i18n language code (e.g., 'ja_JP').
- * @returns 'ja' or 'en', defaulting to 'en' if not Japanese.
- */
-export const getDocumentationLocale = (langCode: string): 'ja' | 'en' => {
-  const baseCode = langCode.split(/[-_]/)[0];
-  return baseCode === 'ja' ? 'ja' : 'en';
-};