Skip to content

Commit 588a536

Browse files
authored
feat: add Thai translation (saicaca#264)
* Create th.ts Created i18n Thai translation file. * Update translation.ts Added Thai language support. * Update config.ts Added Spanish (es) and Thai (th) to commented possible values for `lang` key. * Create README.th.md Created Thai version of README. * Update README.md Added navigation/link to Thai version of README.
1 parent 4483433 commit 588a536

File tree

5 files changed

+104
-3
lines changed

5 files changed

+104
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ A static blog template built with [Astro](https://astro.build).
77
[**🌏 中文**](https://github.com/saicaca/fuwari/blob/main/README.zh-CN.md)   /   
88
[**🌏 日本語**](https://github.com/saicaca/fuwari/blob/main/README.ja-JP.md)   /   
99
[**🌏 한국어**](https://github.com/saicaca/fuwari/blob/main/README.ko.md)   /   
10-
[**🌏 Español**](https://github.com/saicaca/fuwari/blob/main/README.es.md)
10+
[**🌏 Español**](https://github.com/saicaca/fuwari/blob/main/README.es.md)   /   
11+
[**🌏 ไทย**](https://github.com/saicaca/fuwari/blob/main/README.th.md)
1112

1213
> README version: `2024-09-10`
1314

README.th.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# 🍥Fuwari
2+
3+
แม่แบบสำหรับเว็บบล็อกแบบ static สร้างด้วย [Astro](https://astro.build)
4+
5+
[**🖥️ ตัวอย่างการใช้งานจริง (Vercel)**](https://fuwari.vercel.app)   /   
6+
[**📦 เวอร์ชั่นเก่าสำหรับ Hexo**](https://github.com/saicaca/hexo-theme-vivia)
7+
8+
> เวอร์ชั่นของ README: `2024-09-10`
9+
10+
![ภาพตัวอย่าง](https://raw.githubusercontent.com/saicaca/resource/main/fuwari/home.png)
11+
12+
## ✨ คุณสมบัติ
13+
14+
- [x] สร้างด้วย [Astro](https://astro.build) และ [Tailwind CSS](https://tailwindcss.com)
15+
- [x] มีอนิเมชั่นและการเปลี่ยนหน้าอย่างลื่นไหล
16+
- [x] รองรับโหมดสว่าง / โหมดมืด
17+
- [x] ปรับแต่งสีธีมและแบนเนอร์ได้
18+
- [x] Responsive design (หน้าตาเว็บปรับเปลี่ยนตามขนาดจอ)
19+
- [ ] การแสดงความคิดเห็น
20+
- [x] การค้นหา
21+
- [ ] TOC (สารบัญ)
22+
23+
## 🚀 วิธีใช้งาน
24+
25+
1. [Generate repository ใหม่](https://github.com/saicaca/fuwari/generate)ขึ้นมาจากแม่แบบนี้ หรือจะ fork repository นี้ก็ได้
26+
2. เริ่มแก้ไขบล็อกของคุณแบบ local โดยการ clone repository ของคุณ (จากข้อ 1) ไว้ในเครื่องของคุณ แล้วรันคำสั่ง `pnpm install` และ `pnpm add sharp` เพื่อติดตั้ง dependencies ที่จำเป็น
27+
- ติดตั้ง [pnpm](https://pnpm.io) ด้วยคำสั่ง `npm install -g pnpm` ถ้ายังไม่เคยติดตั้ง
28+
3. แก้ไขไฟล์การตั้งค่า `src/config.ts` เพื่อปรับแต่งบล็อกของคุณ
29+
4. รันคำสั่ง `pnpm new-post <filename>` เพื่อสร้างโพสต์ใหม่ใน `src/content/posts/` และแก้ไขไฟล์โพสต์นั้นๆ ให้สมบูรณ์
30+
5. Deploy เว็บบล็อกของคุณไปยัง Vercel, Netlify, GitHub Pages หรือบริการอื่นๆ โดยอ้างอิงวิธีการจาก[คู่มือนี้](https://docs.astro.build/en/guides/deploy/) อย่าลืมแก้ไขการตั้งค่าเว็บไซต์ในไฟล์ `astro.config.mjs` ก่อนที่คุณจะ deploy เว็บ
31+
32+
## ⚙️ Frontmatter ของโพสต์
33+
34+
```yaml
35+
---
36+
title: โพสต์แรกของฉัน
37+
published: 2023-09-09
38+
description: นี่คือโพสต์แรกของเว็บบล็อก Astro อันใหม่ของฉัน
39+
image: ./cover.jpg
40+
tags: [Foo, Bar]
41+
category: Front-end
42+
draft: false
43+
lang: jp # เขียนค่านี้เมื่อภาษาของโพสต์นั้นๆ แตกต่างจากภาษาของเว็บไซต์ที่ตั้งค่าไว้ใน `config.ts` เท่านั้น
44+
---
45+
```
46+
47+
## 🧞 คำสั่ง
48+
49+
คำสั่งที่รันได้ใน terminal จาก root ของโปรเจค:
50+
51+
| คำสั่ง | ผลที่เกิด |
52+
|:------------------------------------|:--------------------------------------------------|
53+
| `pnpm install` และ `pnpm add sharp` | ติดตั้ง dependencies |
54+
| `pnpm dev` | เปิดเซิร์ฟเวอร์เพื่อพัฒนาเว็บแบบ local ที่ `localhost:4321` |
55+
| `pnpm build` | Build เว็บไซต์แบบพร้อมใช้งานจริงไปยังโฟลเดอร์ `./dist/` |
56+
| `pnpm preview` | ดูตัวอย่าง build ของคุณแบบ local ก่อนที่จะ deploy จริง |
57+
| `pnpm new-post <filename>` | สร้างโพสต์ใหม่ |
58+
| `pnpm astro ...` | รันคำสั่ง CLI เช่น `astro add`, `astro check` |
59+
| `pnpm astro --help` | ดูข้อมูลเพิ่มเติมเกี่ยวกับ Astro CLI |

src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { LinkPreset } from './types/config'
99
export const siteConfig: SiteConfig = {
1010
title: 'Fuwari',
1111
subtitle: 'Demo Site',
12-
lang: 'en', // 'en', 'zh_CN', 'zh_TW', 'ja', 'ko'
12+
lang: 'en', // 'en', 'zh_CN', 'zh_TW', 'ja', 'ko', 'es', 'th'
1313
themeColor: {
1414
hue: 250, // Default hue for the theme color, from 0 to 360. e.g. red: 0, teal: 200, cyan: 250, pink: 345
1515
fixed: false, // Hide the theme color picker for visitors

src/i18n/languages/th.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import Key from '../i18nKey'
2+
import type { Translation } from '../translation'
3+
4+
export const th: Translation = {
5+
[Key.home]: 'หน้าแรก',
6+
[Key.about]: 'เกี่ยวกับ',
7+
[Key.archive]: 'คลัง',
8+
[Key.search]: 'ค้นหา',
9+
10+
[Key.tags]: 'ป้ายกำกับ',
11+
[Key.categories]: 'หมวดหมู่',
12+
[Key.recentPosts]: 'โพสต์ล่าสุด',
13+
14+
[Key.comments]: 'ความคิดเห็น',
15+
16+
[Key.untitled]: 'ไม่ได้ตั้งชื่อ',
17+
[Key.uncategorized]: 'ไม่ได้จัดหมวดหมู่',
18+
[Key.noTags]: 'ไม่มีป้ายกำกับ',
19+
20+
[Key.wordCount]: 'คำ',
21+
[Key.wordsCount]: 'คำ',
22+
[Key.minuteCount]: 'นาที',
23+
[Key.minutesCount]: 'นาที',
24+
[Key.postCount]: 'โพสต์',
25+
[Key.postsCount]: 'โพสต์',
26+
27+
[Key.themeColor]: 'สีของธีม',
28+
29+
[Key.lightMode]: 'สว่าง',
30+
[Key.darkMode]: 'มืด',
31+
[Key.systemMode]: 'ตามระบบ',
32+
33+
[Key.more]: 'ดูเพิ่ม',
34+
35+
[Key.author]: 'ผู้เขียน',
36+
[Key.publishedAt]: 'เผยแพร่เมื่อ',
37+
[Key.license]: 'สัญญาอนุญาต',
38+
}

src/i18n/translation.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { en } from './languages/en'
44
import { es } from './languages/es'
55
import { ja } from './languages/ja'
66
import { ko } from './languages/ko'
7+
import { th } from './languages/th'
78
import { zh_CN } from './languages/zh_CN'
89
import { zh_TW } from './languages/zh_TW'
910

@@ -25,6 +26,8 @@ const map: { [key: string]: Translation } = {
2526
ja_jp: ja,
2627
ko: ko,
2728
ko_kr: ko,
29+
th: th,
30+
th_th: th,
2831
}
2932

3033
export function getTranslation(lang: string): Translation {
@@ -34,4 +37,4 @@ export function getTranslation(lang: string): Translation {
3437
export function i18n(key: I18nKey): string {
3538
const lang = siteConfig.lang || 'en'
3639
return getTranslation(lang)[key]
37-
}
40+
}

0 commit comments

Comments
 (0)