mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-17 12:01:33 +02:00
🚀 refactor: optimize i18n logic functions and function naming
This commit is contained in:
parent
74a2b9da1a
commit
1492ae07d2
7 changed files with 118 additions and 174 deletions
|
@ -1,5 +1,5 @@
|
|||
---
|
||||
import { getNextLangUrl, getNextSupportedLangUrl } from '@/i18n/path'
|
||||
import { getNextGlobalLangPath, getNextSupportedLangPath } from '@/i18n/path'
|
||||
import { isPostPage, isTagPage } from '@/utils/page'
|
||||
|
||||
interface Props {
|
||||
|
@ -16,8 +16,8 @@ const useSupportedLangs = isPost || (isTag && supportedLangs.length > 0)
|
|||
|
||||
// Choose a language switch list according to the page type
|
||||
const nextUrl = useSupportedLangs
|
||||
? getNextSupportedLangUrl(currentPath, supportedLangs) // Switch between supported languages
|
||||
: getNextLangUrl(currentPath) // Switch between all languages
|
||||
? getNextSupportedLangPath(currentPath, supportedLangs) // Switch between supported languages
|
||||
: getNextGlobalLangPath(currentPath) // Switch between all languages
|
||||
---
|
||||
|
||||
<a
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue