Skip to content

Commit 4b37c15

Browse files
committed
feat: remove i18n
1 parent 6aded38 commit 4b37c15

24 files changed

+35
-169
lines changed

docs-old/todo/vue.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
mpt
2+
3+
chrome ext
4+
5+
node bind 位图
6+
7+
zig

src/components/ArchivePanel.astro

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
---
22
import { UNCATEGORIZED } from '@constants/constants'
3-
import I18nKey from '../i18n/i18nKey'
4-
import { i18n } from '../i18n/translation'
53
import { getSortedPosts } from '../utils/content-utils'
64
import { getPostUrlBySlug } from '../utils/url-utils'
75
@@ -74,7 +72,7 @@ function formatTag(tag: string[]) {
7472
<div class="w-[15%] md:w-[10%]">
7573
<div class="h-3 w-3 bg-none rounded-full outline outline-[var(--primary)] mx-auto -outline-offset-[2px] z-50 outline-3"></div>
7674
</div>
77-
<div class="w-[70%] md:w-[80%] transition text-left text-50">{group.posts.length} {i18n(I18nKey.postsCount)}</div>
75+
<div class="w-[70%] md:w-[80%] transition text-left text-50">{group.posts.length} 篇文章</div>
7876
</div>
7977
{group.posts.map(post => (
8078
<a href={getPostUrlBySlug(post.slug)}

src/components/LightDarkSwitch.svelte

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<script lang="ts">
22
import type { LIGHT_DARK_MODE } from '@/types/config.ts'
33
import { AUTO_MODE, DARK_MODE, LIGHT_MODE } from '@constants/constants.ts'
4-
import I18nKey from '@i18n/i18nKey'
5-
import { i18n } from '@i18n/translation'
64
import Icon from '@iconify/svelte'
75
import {
86
applyThemeToDocument,
@@ -78,21 +76,21 @@ function hidePanel() {
7876
onclick={() => switchScheme(LIGHT_MODE)}
7977
>
8078
<Icon icon="material-symbols:wb-sunny-outline-rounded" class="text-[1.25rem] mr-3"></Icon>
81-
{i18n(I18nKey.lightMode)}
79+
亮色
8280
</button>
8381
<button class="flex transition whitespace-nowrap items-center !justify-start w-full btn-plain scale-animation rounded-lg h-9 px-3 font-medium active:scale-95 mb-0.5"
8482
class:current-theme-btn={mode === DARK_MODE}
8583
onclick={() => switchScheme(DARK_MODE)}
8684
>
8785
<Icon icon="material-symbols:dark-mode-outline-rounded" class="text-[1.25rem] mr-3"></Icon>
88-
{i18n(I18nKey.darkMode)}
86+
暗色
8987
</button>
9088
<button class="flex transition whitespace-nowrap items-center !justify-start w-full btn-plain scale-animation rounded-lg h-9 px-3 font-medium active:scale-95"
9189
class:current-theme-btn={mode === AUTO_MODE}
9290
onclick={() => switchScheme(AUTO_MODE)}
9391
>
9492
<Icon icon="material-symbols:radio-button-partial-outline" class="text-[1.25rem] mr-3"></Icon>
95-
{i18n(I18nKey.systemMode)}
93+
跟随系统
9694
</button>
9795
</div>
9896
</div>

src/components/PostCard.astro

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ import path from 'path'
33
import PostMetadata from './PostMeta.astro'
44
import ImageWrapper from './misc/ImageWrapper.astro'
55
import { Icon } from 'astro-icon/components'
6-
import { i18n } from '../i18n/translation'
7-
import I18nKey from '../i18n/i18nKey'
86
import { getDir } from '../utils/url-utils'
97
108
interface Props {
@@ -65,9 +63,9 @@ const { remarkPluginFrontmatter } = await entry.render()
6563

6664
<!-- word count and read time -->
6765
<div class="text-sm text-black/30 dark:text-white/30 flex gap-4 transition">
68-
<div>{remarkPluginFrontmatter.words} {" " + i18n(I18nKey.wordsCount)}</div>
66+
<div>{remarkPluginFrontmatter.words} {" "}</div>
6967
<div>|</div>
70-
<div>{remarkPluginFrontmatter.minutes} {" " + i18n(I18nKey.minutesCount)}</div>
68+
<div>{remarkPluginFrontmatter.minutes} {" 分钟"}</div>
7169
</div>
7270

7371
</div>

src/components/PostMeta.astro

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
---
22
import { formatDateToYYYYMMDD } from '../utils/date-utils'
33
import { Icon } from 'astro-icon/components'
4-
import { i18n } from '../i18n/translation'
5-
import I18nKey from '../i18n/i18nKey'
64
import { url } from '../utils/url-utils'
75
86
interface Props {
@@ -56,7 +54,7 @@ const className = Astro.props.class
5654
<a href={url(`/archive/category/${category || 'uncategorized'}/`)} aria-label=`View all posts in the ${category} category`
5755
class="link-lg transition text-50 text-sm font-medium
5856
hover:text-[var(--primary)] dark:hover:text-[var(--primary)] whitespace-nowrap">
59-
{category || i18n(I18nKey.uncategorized)}
57+
{category || '未分类'}
6058
</a>
6159
</div>
6260
</div>
@@ -76,7 +74,7 @@ const className = Astro.props.class
7674
{tag}
7775
</a>
7876
))}
79-
{!(tags && tags.length > 0) && <div class="transition text-50 text-sm font-medium">{i18n(I18nKey.noTags)}</div>}
77+
{!(tags && tags.length > 0) && <div class="transition text-50 text-sm font-medium">无标签</div>}
8078
</div>
8179
</div>
8280
</div>

src/components/Search.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<script lang="ts">
22
import { onMount } from 'svelte'
33
import { url } from '@utils/url-utils.ts'
4-
import { i18n } from '@i18n/translation'
5-
import I18nKey from '@i18n/i18nKey'
64
import Icon from '@iconify/svelte'
75
let keywordDesktop = ''
86
let keywordMobile = ''
@@ -78,7 +76,7 @@ $: search(keywordMobile, false)
7876
dark:bg-white/5 dark:hover:bg-white/10 dark:focus-within:bg-white/10
7977
">
8078
<Icon icon="material-symbols:search" class="absolute text-[1.25rem] pointer-events-none ml-3 transition my-auto text-black/30 dark:text-white/30"></Icon>
81-
<input placeholder="{i18n(I18nKey.search)}" bind:value={keywordDesktop} on:focus={() => search(keywordDesktop, true)}
79+
<input placeholder="搜索" bind:value={keywordDesktop} on:focus={() => search(keywordDesktop, true)}
8280
class="transition-all pl-10 text-sm bg-transparent outline-0
8381
h-full w-40 active:w-60 focus:w-60 text-black/50 dark:text-white/50"
8482
>

src/components/misc/License.astro

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import { formatDateToYYYYMMDD } from '../../utils/date-utils'
33
import { Icon } from 'astro-icon/components'
44
import { licenseConfig, profileConfig } from '../../config'
5-
import { i18n } from '../../i18n/translation'
6-
import I18nKey from '../../i18n/i18nKey'
75
86
interface Props {
97
title: string
@@ -27,15 +25,15 @@ const postUrl = decodeURIComponent(Astro.url.toString())
2725
</a>
2826
<div class="flex gap-6 mt-2">
2927
<div>
30-
<div class="transition text-black/30 dark:text-white/30 text-sm">{i18n(I18nKey.author)}</div>
28+
<div class="transition text-black/30 dark:text-white/30 text-sm">作者</div>
3129
<div class="transition text-black/75 dark:text-white/75 whitespace-nowrap">{profileConf.name}</div>
3230
</div>
3331
<div>
34-
<div class="transition text-black/30 dark:text-white/30 text-sm">{i18n(I18nKey.publishedAt)}</div>
32+
<div class="transition text-black/30 dark:text-white/30 text-sm">发布于</div>
3533
<div class="transition text-black/75 dark:text-white/75 whitespace-nowrap">{formatDateToYYYYMMDD(pubDate)}</div>
3634
</div>
3735
<div>
38-
<div class="transition text-black/30 dark:text-white/30 text-sm">{i18n(I18nKey.license)}</div>
36+
<div class="transition text-black/30 dark:text-white/30 text-sm">许可协议</div>
3937
<a href={licenseConf.url} target="_blank" class="link text-[var(--primary)] whitespace-nowrap">{licenseConf.name}</a>
4038
</div>
4139
</div>

src/components/widget/Categories.astro

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
---
22
import WidgetLayout from './WidgetLayout.astro'
3-
4-
import { i18n } from '../../i18n/translation'
5-
import I18nKey from '../../i18n/i18nKey'
63
import { getCategoryList } from '../../utils/content-utils'
74
import { getCategoryUrl } from '../../utils/url-utils'
85
import ButtonLink from '../control/ButtonLink.astro'
@@ -22,7 +19,7 @@ const className = Astro.props.class
2219
const style = Astro.props.style
2320
---
2421

25-
<WidgetLayout name={i18n(I18nKey.categories)} id="categories" isCollapsed={isCollapsed} collapsedHeight={COLLAPSED_HEIGHT}
22+
<WidgetLayout name='分类' id="categories" isCollapsed={isCollapsed} collapsedHeight={COLLAPSED_HEIGHT}
2623
class={className} style={style}
2724
>
2825
{categories.map((c) =>

src/components/widget/DisplaySettings.svelte

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script lang="ts">
2-
import { i18n } from '@i18n/translation'
3-
import I18nKey from '@i18n/i18nKey'
42
import { getDefaultHue, getHue, setHue } from '@utils/setting-utils'
53
import Icon from '@iconify/svelte'
64
@@ -22,7 +20,7 @@ $: if (hue || hue === 0) {
2220
before:w-1 before:h-4 before:rounded-md before:bg-[var(--primary)]
2321
before:absolute before:-left-3 before:top-[0.33rem]"
2422
>
25-
{i18n(I18nKey.themeColor)}
23+
主题色
2624
<button aria-label="Reset to Default" class="btn-regular w-7 h-7 rounded-md active:scale-90"
2725
class:opacity-0={hue === defaultHue} class:pointer-events-none={hue === defaultHue} on:click={resetHue}>
2826
<div class="text-[var(--btn-content)]">
@@ -38,7 +36,7 @@ $: if (hue || hue === 0) {
3836
</div>
3937
</div>
4038
<div class="w-full h-6 px-1 bg-[oklch(0.80_0.10_0)] dark:bg-[oklch(0.70_0.10_0)] rounded select-none">
41-
<input aria-label={i18n(I18nKey.themeColor)} type="range" min="0" max="360" bind:value={hue}
39+
<input aria-label="主题色" type="range" min="0" max="360" bind:value={hue}
4240
class="slider" id="colorSlider" step="5" style="width: 100%">
4341
</div>
4442
</div>

src/components/widget/Tags.astro

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import WidgetLayout from './WidgetLayout.astro'
44
import ButtonTag from '../control/ButtonTag.astro'
55
import { getTagList } from '../../utils/content-utils'
6-
import { i18n } from '../../i18n/translation'
7-
import I18nKey from '../../i18n/i18nKey'
86
import { url } from '../../utils/url-utils'
97
108
const tags = await getTagList()
@@ -20,7 +18,7 @@ interface Props {
2018
const className = Astro.props.class
2119
const style = Astro.props.style
2220
---
23-
<WidgetLayout name={i18n(I18nKey.tags)} id="tags" isCollapsed={isCollapsed} collapsedHeight={COLLAPSED_HEIGHT} class={className} style={style}>
21+
<WidgetLayout name='标签' id="tags" isCollapsed={isCollapsed} collapsedHeight={COLLAPSED_HEIGHT} class={className} style={style}>
2422
<div class="flex gap-2 flex-wrap">
2523
{tags.map(t => (
2624
<ButtonTag href={url(`/archive/tag/${t.name}/`)} label={`View all posts with the ${t.name} tag`}>

0 commit comments

Comments
 (0)