docs: move i18n realize to posts/i18n, close #80

This commit is contained in:
YunYouJun 2022-07-26 01:53:38 +08:00
parent 7b334c7270
commit 1da7afe9cc
6 changed files with 13 additions and 13 deletions

View File

@ -1,5 +1,5 @@
{
"cSpell.words": ["algoliasearch", "instantsearch", "valaxy", "valaxyjs", "beian", "jiti", "defu", "twikoo"],
"cSpell.words": ["algoliasearch", "instantsearch", "valaxy", "valaxyjs", "beian", "jiti", "unconfig", "defu", "twikoo"],
"i18n-ally.sourceLanguage": "en",
"i18n-ally.keystyle": "nested",
"i18n-ally.localesPaths": ["packages/valaxy/src/client/locales"],

View File

@ -130,7 +130,7 @@ npm run rss
## 单页 i18n {lang="zh-CN"}
More info see [i18n](/docs/guide/i18n).
More info see [i18n](/posts/i18n).
## KaTeX

View File

@ -13,7 +13,7 @@ Valaxy **提出**了一种基于 CSS 面向博客的 i18n 解决方案。
:::
> 如果你想了解实现原理,可参考 [i18n](/guide/i18n)。
> 如果你想了解实现原理,可参考 [i18n](/posts/i18n)。
::: zh-CN
**效果如下**(点击按钮切换):

View File

@ -7,6 +7,7 @@ tags:
- i18n
- 笔记
end: true
layout: default
---
::: tip
@ -16,7 +17,7 @@ You can click this button to toggle locales.
:::
<div class="text-center">
<YunToggleLocale class="shadow" />
<PressToggleLocale class="shadow" />
</div>
::: zh-CN
@ -359,7 +360,7 @@ When the page initializes or switches languages, add the corresponding language
**The effect is as follows** (click the button to switch).
:::
<YunToggleLocale class="shadow" />
<PressToggleLocale class="shadow" />
::: zh-CN
另一种 i18n 方案。

View File

@ -46,7 +46,6 @@ const prevPost = computed(() => posts.value[findCurrentIndex() + 1])
"
style="grid-template-rows: auto 1fr"
>
<PressAuthor v-if="frontmatter.author" :frontmatter="frontmatter" />
<div class="divide-y divide-gray-200 xl:pb-0 xl:col-span-3 xl:row-span-2">
<router-view />
</div>

View File

@ -1,7 +1,8 @@
import { join } from 'path'
import isInstalledGlobally from 'is-installed-globally'
import globalDirs from 'global-dirs'
import { sync as resolve } from 'resolve'
import type resolve from 'resolve'
import { sync as resolveSync } from 'resolve'
import consola from 'consola'
import type { LoadConfigSource } from 'unconfig'
import { loadConfig } from 'unconfig'
@ -37,13 +38,12 @@ export function isPath(name: string) {
return name.startsWith('/') || /^\.\.?[\/\\]/.test(name)
}
export function resolveImportPath(importName: string, ensure: true): string
export function resolveImportPath(importName: string, ensure?: boolean): string | undefined
export function resolveImportPath(importName: string, ensure = false) {
export function resolveImportPath(importName: string, ensure?: true): string
export function resolveImportPath(importName: string, ensure = false, resolveOptions: resolve.SyncOpts = {
preserveSymlinks: false,
}) {
try {
return resolve(importName, {
preserveSymlinks: false,
})
return resolveSync(importName, resolveOptions)
}
catch (error) {
consola.log(error)