diff --git a/astro.config.mjs b/astro.config.mjs
index 19c2d18..7959354 100644
--- a/astro.config.mjs
+++ b/astro.config.mjs
@@ -1,10 +1,10 @@
-import { defineConfig } from 'astro/config';
+import {defineConfig} from 'astro/config';
import sitemap from '@astrojs/sitemap';
import mdx from '@astrojs/mdx';
-import { remarkWordCount } from './src/plugins/remark/wordcount.js';
+import {remarkWordCount} from './src/plugins/remark/wordcount.js';
import cloudflare from '@astrojs/cloudflare';
import remarkMath from "remark-math";
@@ -14,28 +14,33 @@ import partytown from '@astrojs/partytown';
import {remarkModifiedTime} from "./src/plugins/remark/modified-time.mjs";
export default defineConfig({
- site: 'https://terminal-blog.example.com',
- base: '/',
- trailingSlash: 'ignore',
- redirects: {
- // for the old routes still can be accessed
- "/post/[...slug]": "/blog/[...slug]"
- },
-
- build: {
- format: 'directory'
- },
-
- markdown: {
- shikiConfig: {
- theme: 'nord',
- wrap: true
+ site: 'https://terminal-blog.example.com',
+ base: '/',
+ trailingSlash: 'ignore',
+ redirects: {
+ // for the old routes still can be accessed
+ "/post/[...slug]": "/blog/[...slug]"
},
- remarkPlugins: [ remarkMath, remarkWordCount, remarkModifiedTime ],
- rehypePlugins: [ rehypeKatex ]
- },
- integrations: [sitemap(), mdx(), partytown()],
+ build: {
+ format: 'directory'
+ },
- adapter: cloudflare()
+ markdown: {
+ shikiConfig: {
+ theme: 'nord',
+ wrap: true
+ },
+ remarkPlugins: [remarkMath, remarkWordCount, remarkModifiedTime],
+ rehypePlugins: [rehypeKatex]
+ },
+
+ i18n: {
+ locales: ["en", "zh_hans"],
+ defaultLocale: "en",
+ },
+
+ integrations: [sitemap(), mdx(), partytown()],
+
+ adapter: cloudflare()
});
\ No newline at end of file
diff --git a/src/components/BackToTop.astro b/src/components/BackToTop.astro
index 3fe2679..88a73a1 100644
--- a/src/components/BackToTop.astro
+++ b/src/components/BackToTop.astro
@@ -1,8 +1,13 @@
---
import {siteConfig} from "../config";
+import { getLangFromUrl, useTranslations, useTranslatedPath } from '../i18n/utils';
+
+const lang = getLangFromUrl(Astro.url);
+const t = useTranslations(lang);
+const translatePath = useTranslatedPath(lang);
const noscript = siteConfig.noClientJavaScript
---
-{noscript ? :
+{noscript ? :