|
|
@ -9,6 +9,7 @@ export function useLanguageLinks() {
|
|
|
|
const langs = site.value.langs
|
|
|
|
const langs = site.value.langs
|
|
|
|
const localePaths = Object.keys(langs)
|
|
|
|
const localePaths = Object.keys(langs)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// one language
|
|
|
|
if (localePaths.length < 2) {
|
|
|
|
if (localePaths.length < 2) {
|
|
|
|
return null
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -18,9 +19,9 @@ export function useLanguageLinks() {
|
|
|
|
// intentionally remove the leading slash because each locale has one
|
|
|
|
// intentionally remove the leading slash because each locale has one
|
|
|
|
const currentPath = route.path.replace(localePath.value, '')
|
|
|
|
const currentPath = route.path.replace(localePath.value, '')
|
|
|
|
|
|
|
|
|
|
|
|
const candidates = localePaths.map((v) => ({
|
|
|
|
const candidates = localePaths.map((localePath) => ({
|
|
|
|
text: langs[v].label,
|
|
|
|
text: langs[localePath].label,
|
|
|
|
link: `${v}${currentPath}`
|
|
|
|
link: `${localePath}${currentPath}`
|
|
|
|
}))
|
|
|
|
}))
|
|
|
|
|
|
|
|
|
|
|
|
const selectText = theme.value.selectText || 'Languages'
|
|
|
|
const selectText = theme.value.selectText || 'Languages'
|
|
|
|