在 AstroPaper 原主题基础上增加 i18n 支持,不修改原主题 UI
astro-paper-i18n — Astro 博客模板
作者 yousef8
AstroPaper 主题的 i18n 分支,在保留原主题 UI 的基础上加入多语言路由、语言切换与 RTL 支持。
看看你的网站会是什么样
浏览真实页面截图,比较内容排版与手机效果。点击下方缩略图切换,放大查看整页细节。
全部页面与视图 3
截图用于了解视觉与布局,交互效果请以实际项目为准。
值得关注的模板亮点
从已有项目资料中,快速了解它的特点。
支持 RTL 语言,界面在 LTR 与 RTL 下保持一致
UI 文案、数字与日期均可本地化,并提供语言切换器
sitemap、RSS 与 OG 图片生成均带 i18n 支持
i18n 集成使用 TypeScript 做类型安全约束
包含基于 Vitest 的单元测试及覆盖率命令
模板详细介绍
这是 yousef8 维护的 AstroPaper 分支,目标是在原主题上加入国际化(i18n)能力。它使用 Astro 的 i18n 路由实现多语言,作者作为阿拉伯语母语者,特别保证了对 RTL 语言(如阿拉伯语、波斯语)的支持,并声明不修改原主题的 UI,只增加 i18n 相关功能。
功能上覆盖 UI 文案、数字与日期的本地化,提供语言切换器、无障碍相关翻译,以及带 i18n 的 sitemap、RSS 和 OG 图片生成。i18n 集成使用 TypeScript 做类型约束。已知限制包括:satori 不支持 RTL 语言,因此 RTL 的 OG 图片会出现布局问题;屏幕阅读器模式下的样式目前是坏的;路由翻译仍在计划中,尚未实现。
使用方式上,需要为每种语言创建翻译文件、在 locale 配置中登记语言档案(名称、翻译、BCP-47 语言标签、布局方向、OG 图片所用 Google 字体),about 页面改为独立的内容集合,博客文章需放在以语言键命名的目录下,否则不会被站点收录。项目包含基于 Vitest 的单元测试,但测试覆盖尚不完整。
适合你的项目吗?
适用场景
- 需要为博客提供多语言版本,并希望沿用 AstroPaper 外观
- 面向阿拉伯语、波斯语等 RTL 语言读者发布内容
- 希望 sitemap、RSS 与 OG 图片按语言分别生成
- 在 Astro 项目中需要一套类型安全的 i18n 配置参考
适合人群
- 使用 Astro 并基于 AstroPaper 搭建多语言博客的开发者
- 需要 RTL 布局支持的内容站点
- 希望以 MIT 许可免费使用和修改代码的个人或团队
上手与定制指南
结合仓库当前版本的说明,按下面的资料检查内容、配置与运行要求。
- 1
可通过 Astro CLI 以 yousef8/astro-paper-i18n 为模板创建项目,或直接 fork 仓库
- 2
在 src/i18n/locales 下按 <locale_key>.ts 新建翻译文件,导出 I18nStrings 类型对象
- 3
在 src/i18n/config.ts 的 localeToProfile 中登记语言档案,包括名称、翻译、BCP-47 语言标签、方向与 OG 图片字体
- 4
about 页面内容放在 src/content/about 下,命名为 about.<locale_key>.md;博客文章需放在 src/content/blog 下以语言键命名的目录中
- 5
修改语言配置后可能需要重启开发服务器才能生效
授权与来源资料
使用条件与限制
免费使用 · 保留许可声明本次收录的是公开仓库中采用 MIT 许可的免费版本;免费范围为该版本代码,不代表外部服务或第三方素材免费。
使用时需要遵守
- 允许免费使用、修改、商用和分发该版本代码。
- 分发代码副本或实质性部分时,保留原作者版权声明和完整 MIT 许可声明。
- 代码按现状提供;担保与责任限制以原许可证及适用法律为准。
额外费用与待核对事项
- 演示图片、字体、图标及其他第三方素材需按各自许可核对,不能仅凭代码的 MIT 许可判断。
- 域名、托管、数据库、支付或 AI 等外部服务可能另外收费。
- 使用 satori 生成 OG 图片时不支持 RTL 语言,RTL 语言的 OG 图片会出现布局问题,需自行规避或接受该缺陷。
- 屏幕阅读器模式下的样式目前是损坏的,需要修复,无障碍场景下使用需注意此已知问题。
- 路由翻译(Route translations)仍处于计划中、尚未实现,多语言路由路径本身不会随语言切换。
- 博客文章必须放在 src/content/blog 下以语言键命名的目录中,放在语言目录之外的文章不会被站点收录。
- 修改语言配置后可能需要重启开发服务器才能看到变更,热更新不一定生效。
- locale 配置中的 Google 字体名仅用于 OG 图片生成,且该字体需支持 400 与 700 字重,空格需替换为 '+'。
查看原文依据
Permission is hereby granted, free of charge
许可证原文
Note: satori does not support RTL languages, causing layout issues for RTL OG images.
README 原文
- [ ] Styling in screen reader mode is currently broken and requires fixes.
README 原文
- [ ] 📋 **Planned:** - [ ] Route translations.
README 原文
Any blog outside locale folder will not be considered by the site.
README 原文
**Note:** you may need to restart the dev server to see the changes.
README 原文
https://github.com/yousef8/astro-paper-i18n/blob/main/LICENSEhttps://github.com/yousef8/astro-paper-i18n/blob/main/README.md- Google font name is used only in [OG images](https://magefan.com/blog/open-graph-meta-tags).
README 原文
DeepSeek 根据仓库许可证和 README 整理 ·2026-10-04。结果仅覆盖已读取资料,依赖、图片、字体及后续条款变更以各自原文为准。
项目核对记录与介绍依据
模板资料
- 来源平台
- Astro Themes
- 资料与维护参考分
- 资料较完整 · 87 / 100
- 技术栈
- Astro
- 网站类型
- 博客
这个分数如何计算
本站按许可资料(最高30分)、演示链接(12分)、预览图(10分)、Star数(15分)、记录的维护时间(15分)、描述完整度(8分)、功能记录(5分)和分类资料(5分)计算。它不是代码、安全或性能测试,也不是 Google 评分;有链接不代表已实测可用。
这个项目需要核对什么
- 记录的仓库更新时间
- 2025-12-28
- 截图检查日期
- 2026-10-04
已收录演示链接。请用你的内容与屏幕尺寸检查;有演示不代表表单、认证或支付已经可用。
目录记录的主要技术栈是 Astro。请通过依赖清单和锁文件核对实际版本与托管要求。这些说明基于收录资料,不代表代码审计或部署实测。
查看具体选型方法 →介绍的制作与核对状态
介绍由 AI 辅助整理目录与仓库资料。仓库作者不等于这篇介绍的审核者。
审核声明: [email protected] · 2026-10-04
查看当时使用的来源资料
SHA-256: edf366ae291ebf3947335f105d34ef4d82231a26e419f6181858095b97820a8e
2026-10-04T07:38:27.328Z
来源文件 / 仓库# AstroPaper with I18n
🌍 [اقرأنى بالعربية](README.ar.md)
<div align='center'>

</div>
[](http://commitizen.github.io/cz-cli/)


[](https://app.netlify.com/sites/astro-paper-i18n/deploys)
This repository is a fork of the [AstroPaper](https://github.com/satnaing/astro-paper) theme, enhanced to support internationalization (i18n).
The fork Builds upon the original AstroPaper theme to integrate i18n functionality.
I18n integration is implemented using [Astorjs i18n routing](https://docs.astro.build/en/guides/internationalization/)
As I'm a native Arabic speaker, I made sure the i18n integration supports RTL languages (etc Arabic, Persian,...).
If god wills, this fork will maintain synchronization with the original [AstroPaper](https://github.com/satnaing/astro-paper) theme.
This Fork does not modify the original theme’s UI; it solely adds i18n support.
## Table Of Contents
- [🔥 Features](#-features)
- [UI Enhancements](#ui-enhancements)
- [i18n Features](#i18n-features)
- [🧪 Testing](#-testing)
- [Lighthouse Score](#lighthouse-score)
- [Installation](#installation)
- [📖 How To Use](#-how-to-use)
- [🛠️ Configuration](#%EF%B8%8F-configuration)
- [🔧 Site Configurations](#-site-configurations)
- [🌐 Locale Configurations](#-locale-configurations)
- [🧞 Commands](#-commands)
- [🚧 Known Issues](#-known-issues)
## 🔥 Features
This project includes all the features of the original [AstroPaper](https://github.com/satnaing/astro-paper) theme, with the following enhancements:
### UI Enhancements
- [x] **Direction Agnostic:**
- [x] Full RTL support.
- [x] Consistent UI for both `LTR` and `RTL` directions.
### i18n Features
- [x] UI translations, including numbers and dates.
- [x] Language switcher.
- [x] Accessibility-related translations.
- [x] Type-safe i18n integration using TypeScript.
- [x] Sitemaps with i18n support ([`@astrojs/sitemap`](https://docs.astro.build/en/guides/integrations-guide/sitemap/)).
- [x] OG image generation with i18n support
- Note: satori does not support RTL languages, causing layout issues for RTL OG images.
- [x] RSS Feeds with i18n support ([`@astrojs/rss`](https://docs.astro.build/en/guides/rss/)).
- [ ] 📋 **Planned:**
- [ ] Route translations.
### 🧪 Testing
- [x] Unit testing with [Vitest](https://vitest.dev/)
- [x] Unit testing for i18n configurations and utilities
- [ ] Unit testing for [src/utils](/src/utils)
- [ ] Unit testing for [src/config.ts](/src/config.ts)
## Lighthouse Score
Click to view full report
<p align="center">
<a href="https://pagespeed.web.dev/analysis/https-yousef8-github-io-AstroPaperI18n-ar/d2cqwqovpv?form_factor=desktop">
<img width="710" alt="AstroPaper I18n Lighthouse Score" src="AstroPaper-lighthouse-score.svg">
<a>
</p>
## Installation
You can fork the repo
Or you can install it using Astrojs cli
```bash
pnpm create astro@latest --template yousef8/astro-paper-i18n
```
## 📖 How To Use
### 1- Create translations file
Go to [src/i18n/locales](/src/i18n/locales) and create a file for your locale (e.g. es, ja, etc..), it should be named as `<locale_key>.ts` (e.g. es.ts, ja.ts, etc..).
Export a variable of `I18nStrings` type from `@i18n/types` with all the translations as key value pairs.
Take a look at the type at [/src/i18n/types.ts](/src/i18n/types.ts) and example file [/src/i18n/locales/ar.ts](/src/i18n/locales/ar.ts)
### 2- Define locale configuration
Go to [src/i18n/config.ts](/src/i18n/config.ts) and define a locale profile for your locale inside the configuration object `localeToProfile`.
Locale configuration is used to define the name of the locale, the translations, the language tag, the UI layout direction, and the Google font name.
Create a locale key which must be in all lowercase and complient with BCP-47 names. (eg. ar, en, es, ja, etc..), it's value is an object with the following keys:
- Assign a name to the `name` key in your locale profile, it will be used in the language picker.
- Assign translations file you created in step 1 to the `messages` key in your locale profile.
- Language tag must be in BCP47 name compliant, it's used to localize date and time in original AstroPaper theme, but it's **scope was expanded to localize all the numbers too**. (eg. en-US, ar-EG, es-ES, ja-JP, etc..)
- Google font name is used only in [OG images](https://magefan.com/blog/open-graph-meta-tags).
- set the `default` key to `true` if you want to set it, if no locale is set as default, the first locale in the object is used as the default.
- set the `direction` key to one of supported values `rtl | ltr | auto` corresponds to html `dir` tag directives values
**Note:** you may need to restart the dev server to see the changes.
**Note:** [satori](https://github.com/vercel/satori) does not support RTL languages, causing layout issues for RTL [OG images](https://magefan.com/blog/open-graph-meta-tags).
### 3- Add about page
The about page now has it's own [content collection](https://docs.astro.build/en/guides/content-collections/) because this theme supports i18n and you will likely need about page content in multiple locales.
Go to [src/content/about](/src/content/about) and create a file for your locale, it should be named as `about.<locale_key>.md` (e.g. about.en.md, about.es.md, etc..).
Same frontmatter keys as in original AstroPaper theme are supported `title` and `description` for the page title and description.
### 4- Add your content
Under [src/conent/blog](/src/content/blog) create a folder with your locale key (e.g. es, ja, etc..) as it's name and add your content in markdown format.
Any blog outside locale folder will not be considered by the site.
That's it, you're done 🎈🎉 🥳!
See [AstroPaper Docs](https://github.com/satnaing/astro-paper?tab=readme-ov-file#-documentation) for more info as this project builds upon it while to only support i18n, but everything else should be the same.
## 🛠️ Configuration
The same way to [use and configure AstroTheme](https://github.com/satnaing/astro-paper?tab=readme-ov-file#-project-structure), but with some changes.
### 🔧 Site Configurations
`SITE.title` and `SITE.desc` configuration has been replaced with `site.title` and `site.desc` translation, which is now used across whole site.
```diff
// src/config.ts
export const SITE: Site = {
//...
- title: "AstroPaper I18n",
- desc: "A fork of AstroPaper theme with support for I18n",
//...
};
```
```diff
// src/i18n/types.ts
export interface I18nStrings {
+ "site.title": string;
+ "site.desc": string;
// ... other translations
```
### 🌐 Locale Configurations
Locale configuration has been moved from `src/config.ts` to a dedicated file for better organization.
```diff
// src/config.ts
-export const LOCALE = {
- lang: "en", // html lang code. Set this empty and default will be "en"
- langTag: ["en-EN"], // BCP 47 Language Tags. Set this empty [] to use the environment default
-} as const;
export const LOGO_IMAGE = {
```
Instead Locale configuration is now handled in `src/i18n/config.ts`:
```ts
// src/i18n/config.ts
export const localeToProfile = {
// local key must be all lowercase and complaint with BCP-47
ar: {
name: "العربية", // Name presented in language picker
messages: ARLocale, // Locale translations
langTag: "ar-EG", // BCP 47 Language Tag (used for dates, numbers, and sitemap)
direction: "rtl", // UI layout direction
googleFontName: "Cairo", // For OG image generation, font must support 400 and 700 weights, replace spaces with '+'
},
en: {
name: "English",
messages: ENLocale,
langTag: "en-US",
direction: "ltr",
googleFontName: "IBM+Plex+Mono",
default: true,
},
} satisfies Record<string, LocaleProfile>;
```
## 🧞 Commands
Same [commands as in original theme](https://github.com/satnaing/astro-paper/tree/main?tab=readme-ov-file#-commands) with addition to
| Command | Action |
| :------------------- | :------------------------------------------------------------------------------------------ |
| `npm test` | Run all unit tests once and exit [learn more](https://vitest.dev/guide/cli.html#vitest-run) |
| `npm run test:watch` | Run unit tests in watch mode [learn more](https://vitest.dev/guide/cli.html#vitest-watch) |
| `npm run coverage` | Generate unit testing coverage report [learn more](https://vitest.dev/guide/coverage.html) |
## 🚧 Known Issues
- [ ] Styling in screen reader mode is currently broken and requires fixes.
- Contributions are welcome!
看看同类模板
对比同技术栈与用途的模板,找到更适合的视觉与内容结构。

astrowind
⭕️ AstroWind: A free template using Astro v7 and Tailwind CSS v4. Astro starter theme.
Astro · 博客

astro-paper
A minimal, accessible and SEO-friendly Astro blog theme.
Astro · 博客

fuwari
✨A static blog template built with Astro.
Astro · 博客

Firefly
Firefly 是一款基于 Astro 的静态博客主题,由 CuteLeaf 在 saicaca 的 Fuwari 模板基础上二次开发,主打清新美观的视觉风格。
Astro · 博客

astro-theme-cactus
A simple Astro theme. Use it to create your blog or website.
Astro · 作品集

astrofy
Astrofy is a free and open-source template for your Personal Portfolio Website built with Astro and TailwindCS…
Astro · 作品集
