Skip to content

Commit

Permalink
fix: disable lang
Browse files Browse the repository at this point in the history
  • Loading branch information
kazupon committed Oct 2, 2023
1 parent 65001ad commit e09d325
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Expand Up @@ -6,4 +6,5 @@ dist-ssr
*.swp
*~
*.local
.vscode
.vscode
cache
2 changes: 1 addition & 1 deletion .vitepress/config.ts
Expand Up @@ -12,7 +12,7 @@ const mainInfo = {

export default defineConfig({
srcExclude: ['**/README.md'],
cleanUrls: true,
// cleanUrls: true,
vite: {
build: {
minify: false
Expand Down
11 changes: 6 additions & 5 deletions .vitepress/theme/Navigation.vue
Expand Up @@ -29,10 +29,10 @@ const siteNav = computed(() => {
return site.value.themeConfig.nav
})
const onChange = (e: Event) => {
const target = e.target as HTMLInputElement
router.go(target.value === 'en' ? '/' : `/${target.value}`)
}
// DISABLE: const onChange = (e: Event) => {
// DISABLE: const target = e.target as HTMLInputElement
// DISABLE: router.go(target.value === 'en' ? '/' : `/${target.value}/`)
// DISABLE: }
</script>

<template>
Expand All @@ -48,6 +48,7 @@ const onChange = (e: Event) => {
{{ text }}
</a>
</template>
<!-- DISABLE:
<form class="locale">
<select @change="onChange">
<option
Expand All @@ -59,7 +60,7 @@ const onChange = (e: Event) => {
</option>
</select>
</form>
</div>
--></div>
</nav>
</template>

Expand Down
4 changes: 3 additions & 1 deletion .vitepress/theme/index.ts
Expand Up @@ -9,7 +9,7 @@ import type { Theme } from 'vitepress'

const LOCALE_PATH_MAP = {
root: '/',
ja: '/ja'
ja: '/ja/'
} as Record<string, string>

export default {
Expand All @@ -36,11 +36,13 @@ export default {

// TODO: should change to more smart way
// locale change via router path
/* DISABLE
watch(router.route, val => {
console.log('watch route ...', val, i18n.global.locale)
if (localeMap[val.path]) {
i18n.global.locale.value = localeMap[val.path]
}
})
*/
}
} satisfies Theme

0 comments on commit e09d325

Please sign in to comment.