feat: add Thai translation (#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.
This commit is contained in:
twystpaki
2024-12-31 16:02:23 +07:00
committed by GitHub
parent 4483433dd7
commit 588a536e87
5 changed files with 104 additions and 3 deletions

View File

@@ -7,7 +7,8 @@ A static blog template built with [Astro](https://astro.build).
[**🌏 中文**](https://github.com/saicaca/fuwari/blob/main/README.zh-CN.md)   /   
[**🌏 日本語**](https://github.com/saicaca/fuwari/blob/main/README.ja-JP.md)   /   
[**🌏 한국어**](https://github.com/saicaca/fuwari/blob/main/README.ko.md)   /   
[**🌏 Español**](https://github.com/saicaca/fuwari/blob/main/README.es.md)
[**🌏 Español**](https://github.com/saicaca/fuwari/blob/main/README.es.md)   /   
[**🌏 ไทย**](https://github.com/saicaca/fuwari/blob/main/README.th.md)
> README version: `2024-09-10`

59
README.th.md Normal file
View File

@@ -0,0 +1,59 @@
# 🍥Fuwari
แม่แบบสำหรับเว็บบล็อกแบบ static สร้างด้วย [Astro](https://astro.build)
[**🖥️ ตัวอย่างการใช้งานจริง (Vercel)**](https://fuwari.vercel.app)   /   
[**📦 เวอร์ชั่นเก่าสำหรับ Hexo**](https://github.com/saicaca/hexo-theme-vivia)
> เวอร์ชั่นของ README: `2024-09-10`
![ภาพตัวอย่าง](https://raw.githubusercontent.com/saicaca/resource/main/fuwari/home.png)
## ✨ คุณสมบัติ
- [x] สร้างด้วย [Astro](https://astro.build) และ [Tailwind CSS](https://tailwindcss.com)
- [x] มีอนิเมชั่นและการเปลี่ยนหน้าอย่างลื่นไหล
- [x] รองรับโหมดสว่าง / โหมดมืด
- [x] ปรับแต่งสีธีมและแบนเนอร์ได้
- [x] Responsive design (หน้าตาเว็บปรับเปลี่ยนตามขนาดจอ)
- [ ] การแสดงความคิดเห็น
- [x] การค้นหา
- [ ] TOC (สารบัญ)
## 🚀 วิธีใช้งาน
1. [Generate repository ใหม่](https://github.com/saicaca/fuwari/generate)ขึ้นมาจากแม่แบบนี้ หรือจะ fork repository นี้ก็ได้
2. เริ่มแก้ไขบล็อกของคุณแบบ local โดยการ clone repository ของคุณ (จากข้อ 1) ไว้ในเครื่องของคุณ แล้วรันคำสั่ง `pnpm install` และ `pnpm add sharp` เพื่อติดตั้ง dependencies ที่จำเป็น
- ติดตั้ง [pnpm](https://pnpm.io) ด้วยคำสั่ง `npm install -g pnpm` ถ้ายังไม่เคยติดตั้ง
3. แก้ไขไฟล์การตั้งค่า `src/config.ts` เพื่อปรับแต่งบล็อกของคุณ
4. รันคำสั่ง `pnpm new-post <filename>` เพื่อสร้างโพสต์ใหม่ใน `src/content/posts/` และแก้ไขไฟล์โพสต์นั้นๆ ให้สมบูรณ์
5. Deploy เว็บบล็อกของคุณไปยัง Vercel, Netlify, GitHub Pages หรือบริการอื่นๆ โดยอ้างอิงวิธีการจาก[คู่มือนี้](https://docs.astro.build/en/guides/deploy/) อย่าลืมแก้ไขการตั้งค่าเว็บไซต์ในไฟล์ `astro.config.mjs` ก่อนที่คุณจะ deploy เว็บ
## ⚙️ Frontmatter ของโพสต์
```yaml
---
title: โพสต์แรกของฉัน
published: 2023-09-09
description: นี่คือโพสต์แรกของเว็บบล็อก Astro อันใหม่ของฉัน
image: ./cover.jpg
tags: [Foo, Bar]
category: Front-end
draft: false
lang: jp # เขียนค่านี้เมื่อภาษาของโพสต์นั้นๆ แตกต่างจากภาษาของเว็บไซต์ที่ตั้งค่าไว้ใน `config.ts` เท่านั้น
---
```
## 🧞 คำสั่ง
คำสั่งที่รันได้ใน terminal จาก root ของโปรเจค:
| คำสั่ง | ผลที่เกิด |
|:------------------------------------|:--------------------------------------------------|
| `pnpm install` และ `pnpm add sharp` | ติดตั้ง dependencies |
| `pnpm dev` | เปิดเซิร์ฟเวอร์เพื่อพัฒนาเว็บแบบ local ที่ `localhost:4321` |
| `pnpm build` | Build เว็บไซต์แบบพร้อมใช้งานจริงไปยังโฟลเดอร์ `./dist/` |
| `pnpm preview` | ดูตัวอย่าง build ของคุณแบบ local ก่อนที่จะ deploy จริง |
| `pnpm new-post <filename>` | สร้างโพสต์ใหม่ |
| `pnpm astro ...` | รันคำสั่ง CLI เช่น `astro add`, `astro check` |
| `pnpm astro --help` | ดูข้อมูลเพิ่มเติมเกี่ยวกับ Astro CLI |

View File

@@ -9,7 +9,7 @@ import { LinkPreset } from './types/config'
export const siteConfig: SiteConfig = {
title: 'Fuwari',
subtitle: 'Demo Site',
lang: 'en', // 'en', 'zh_CN', 'zh_TW', 'ja', 'ko'
lang: 'en', // 'en', 'zh_CN', 'zh_TW', 'ja', 'ko', 'es', 'th'
themeColor: {
hue: 250, // Default hue for the theme color, from 0 to 360. e.g. red: 0, teal: 200, cyan: 250, pink: 345
fixed: false, // Hide the theme color picker for visitors

38
src/i18n/languages/th.ts Normal file
View File

@@ -0,0 +1,38 @@
import Key from '../i18nKey'
import type { Translation } from '../translation'
export const th: Translation = {
[Key.home]: 'หน้าแรก',
[Key.about]: 'เกี่ยวกับ',
[Key.archive]: 'คลัง',
[Key.search]: 'ค้นหา',
[Key.tags]: 'ป้ายกำกับ',
[Key.categories]: 'หมวดหมู่',
[Key.recentPosts]: 'โพสต์ล่าสุด',
[Key.comments]: 'ความคิดเห็น',
[Key.untitled]: 'ไม่ได้ตั้งชื่อ',
[Key.uncategorized]: 'ไม่ได้จัดหมวดหมู่',
[Key.noTags]: 'ไม่มีป้ายกำกับ',
[Key.wordCount]: 'คำ',
[Key.wordsCount]: 'คำ',
[Key.minuteCount]: 'นาที',
[Key.minutesCount]: 'นาที',
[Key.postCount]: 'โพสต์',
[Key.postsCount]: 'โพสต์',
[Key.themeColor]: 'สีของธีม',
[Key.lightMode]: 'สว่าง',
[Key.darkMode]: 'มืด',
[Key.systemMode]: 'ตามระบบ',
[Key.more]: 'ดูเพิ่ม',
[Key.author]: 'ผู้เขียน',
[Key.publishedAt]: 'เผยแพร่เมื่อ',
[Key.license]: 'สัญญาอนุญาต',
}

View File

@@ -4,6 +4,7 @@ import { en } from './languages/en'
import { es } from './languages/es'
import { ja } from './languages/ja'
import { ko } from './languages/ko'
import { th } from './languages/th'
import { zh_CN } from './languages/zh_CN'
import { zh_TW } from './languages/zh_TW'
@@ -25,6 +26,8 @@ const map: { [key: string]: Translation } = {
ja_jp: ja,
ko: ko,
ko_kr: ko,
th: th,
th_th: th,
}
export function getTranslation(lang: string): Translation {