mirror of
https://iceshrimp.dev/Crimekillz/jointrashposs.git
synced 2024-11-22 00:43:50 +01:00
7dfcc6a8ff
(一部のハッキーな手法が死んでいたのでその修正も)
12 lines
473 B
TypeScript
12 lines
473 B
TypeScript
import type { LocaleCodes } from '@/assets/data/locales';
|
|
import { locales } from "@/assets/data/locales";
|
|
|
|
/** useSwitchLocalePathのラッパー関数。 */
|
|
export function useGSwitchLocalePath() {
|
|
const switchLocalePath = useSwitchLocalePath();
|
|
|
|
return (locale: LocaleCodes) => {
|
|
const _path = switchLocalePath(locale);
|
|
return new RegExp(`^/(${locales.map((v) => v.code).join('|')})/`).test(_path) ? _path : `/${locales[0].code}${_path}`;
|
|
}
|
|
} |