Add localized paths

This commit is contained in:
Sakura Knoll
2022-01-03 14:06:15 +09:00 Unverified
parent 8bc576208a
commit 167d8e6623
6 changed files with 54 additions and 31 deletions
+9
View File
@@ -6,3 +6,12 @@ export function getI18NProps(
) {
return serverSideTranslations(locale, ['common', ...nameSpaces])
}
export function generateI18NPaths(paths: { params: any; locale?: string }[]) {
return paths.reduce<{ params: any; locale?: string }[]>((newPaths, path) => {
newPaths.push(path)
newPaths.push({ ...path, locale: 'ko-KR' })
return newPaths
}, [])
}