refactor: update language configuration

This commit is contained in:
radishzzz 2025-03-15 01:02:45 +00:00
parent ff59dc1a7c
commit 22dc899a95
25 changed files with 53 additions and 188 deletions

View file

@ -1,7 +1,6 @@
---
import { themeConfig } from '@/config'
import { defaultLocale } from '@/i18n/config'
import { walineLocaleMap } from '@/i18n/ui'
import { defaultLocale, themeConfig } from '@/config'
import { walineLocaleMap } from '@/i18n/config'
// Theme color configuration
const {

View file

@ -24,7 +24,7 @@ const year = Number(startYear) === currentYear
className,
]}
>
<!-- only show on desktop -->
<!-- Only show on desktop -->
<div class="mb-11.5 ml-1.5 hidden gap-7 lg:flex">
<ThemeToggle />
<LanguageSwitcher supportedLangs={supportedLangs} />

View file

@ -1,6 +1,6 @@
---
import PostTime from '@/components/PostTime.astro'
import { defaultLocale } from '@/i18n/config'
import { defaultLocale } from '@/config'
interface Post {
data: {
@ -16,7 +16,6 @@ interface Post {
}
}
// Get post list and page language parameter from props
const { posts, lang } = Astro.props
export interface Props {
@ -24,9 +23,8 @@ export interface Props {
lang?: string
}
// Get multilingual post URL path
function getPostPath(post: Post) {
// If abbrlink is set, it will be used instead of slug
// Prioritize abbrlink over slug
const postPath = post.data.abbrlink || post.slug
// Add language prefix to URL if current page is in a language subdirectory and not the default language
return lang && lang !== defaultLocale ? `/${lang}/posts/${postPath}/` : `/posts/${postPath}/`

View file

@ -1,5 +1,4 @@
<button
id="theme-toggle"
aria-label="Switch light/dark theme"
class="button-theme-toggle w-4.2 uno-button"
>