このコミットが含まれているのは:
2026-10-26 19:31:00 +09:00
コミット f44a436e20
12個のファイルの変更、95行の追加、41行の削除
+1
ファイルの表示
@@ -41,6 +41,7 @@ type DialogueFormOptions = { title: ReactNode
description?: ReactNode
body: (controls: DialogueFormControls) => ReactNode
cancelText?: ReactNode
footerLayout?: 'inline'
size?: 'default' | 'large' | 'viewport' }
type DialogueAPI =
+8 -9
ファイルの表示
@@ -17,11 +17,6 @@ export const fetchLocales = (): Promise<{ locales: AvailableLocale[] }> =>
export const LOCALE_LABELS: Record<LocaleCode, string> = {
ja: '日本語', 'ain-Kana': 'ヤウンモシルン アイヌ イタㇰ' }
const LEGACY_ROOTS = [
'posts', 'tags', 'nico', 'theatres', 'materials', 'wiki', 'help',
'users', 'settings', 'tos', 'gekanator', 'more']
export const isLocaleCode = (value: unknown): value is LocaleCode =>
SUPPORTED_LOCALES.some (locale => locale === value)
@@ -73,11 +68,15 @@ export const switchLocalePath = (
`/${ locale }${ unlocalisedPath (location.pathname) }${ location.search }${ location.hash }`
// Keep automatic selection independent of the page and API route trees.
export const automaticallySelectedLocale = (): LocaleCode => 'ja'
export const legacyLocalePath = (
location: { pathname: string; search: string; hash: string },
isPage: (pathname: string) => boolean = () => false,
): string | null => {
const root = location.pathname.split ('/')[1]
return (location.pathname === '/' || LEGACY_ROOTS.includes (root))
? `/ja${ location.pathname }${ location.search }${ location.hash }`
: null
if (localeFromPath (location.pathname) != null || !isPage (location.pathname))
return null
return switchLocalePath (location, automaticallySelectedLocale ())
}