format all code (#386)

This commit is contained in:
Katsuyuki Karasawa
2025-04-08 23:08:31 +09:00
committed by GitHub
parent 7ea2f7f40f
commit 286b050fa8
61 changed files with 1329 additions and 1307 deletions

View File

@@ -1,37 +1,37 @@
enum I18nKey {
home = 'home',
about = 'about',
archive = 'archive',
search = 'search',
home = "home",
about = "about",
archive = "archive",
search = "search",
tags = 'tags',
categories = 'categories',
recentPosts = 'recentPosts',
tags = "tags",
categories = "categories",
recentPosts = "recentPosts",
comments = 'comments',
comments = "comments",
untitled = 'untitled',
uncategorized = 'uncategorized',
noTags = 'noTags',
untitled = "untitled",
uncategorized = "uncategorized",
noTags = "noTags",
wordCount = 'wordCount',
wordsCount = 'wordsCount',
minuteCount = 'minuteCount',
minutesCount = 'minutesCount',
postCount = 'postCount',
postsCount = 'postsCount',
wordCount = "wordCount",
wordsCount = "wordsCount",
minuteCount = "minuteCount",
minutesCount = "minutesCount",
postCount = "postCount",
postsCount = "postsCount",
themeColor = 'themeColor',
themeColor = "themeColor",
lightMode = 'lightMode',
darkMode = 'darkMode',
systemMode = 'systemMode',
lightMode = "lightMode",
darkMode = "darkMode",
systemMode = "systemMode",
more = 'more',
more = "more",
author = 'author',
publishedAt = 'publishedAt',
license = 'license',
author = "author",
publishedAt = "publishedAt",
license = "license",
}
export default I18nKey
export default I18nKey;

View File

@@ -1,38 +1,38 @@
import Key from '../i18nKey'
import type { Translation } from '../translation'
import Key from "../i18nKey";
import type { Translation } from "../translation";
export const en: Translation = {
[Key.home]: 'Home',
[Key.about]: 'About',
[Key.archive]: 'Archive',
[Key.search]: 'Search',
[Key.home]: "Home",
[Key.about]: "About",
[Key.archive]: "Archive",
[Key.search]: "Search",
[Key.tags]: 'Tags',
[Key.categories]: 'Categories',
[Key.recentPosts]: 'Recent Posts',
[Key.tags]: "Tags",
[Key.categories]: "Categories",
[Key.recentPosts]: "Recent Posts",
[Key.comments]: 'Comments',
[Key.comments]: "Comments",
[Key.untitled]: 'Untitled',
[Key.uncategorized]: 'Uncategorized',
[Key.noTags]: 'No Tags',
[Key.untitled]: "Untitled",
[Key.uncategorized]: "Uncategorized",
[Key.noTags]: "No Tags",
[Key.wordCount]: 'word',
[Key.wordsCount]: 'words',
[Key.minuteCount]: 'minute',
[Key.minutesCount]: 'minutes',
[Key.postCount]: 'post',
[Key.postsCount]: 'posts',
[Key.wordCount]: "word",
[Key.wordsCount]: "words",
[Key.minuteCount]: "minute",
[Key.minutesCount]: "minutes",
[Key.postCount]: "post",
[Key.postsCount]: "posts",
[Key.themeColor]: 'Theme Color',
[Key.themeColor]: "Theme Color",
[Key.lightMode]: 'Light',
[Key.darkMode]: 'Dark',
[Key.systemMode]: 'System',
[Key.lightMode]: "Light",
[Key.darkMode]: "Dark",
[Key.systemMode]: "System",
[Key.more]: 'More',
[Key.more]: "More",
[Key.author]: 'Author',
[Key.publishedAt]: 'Published at',
[Key.license]: 'License',
}
[Key.author]: "Author",
[Key.publishedAt]: "Published at",
[Key.license]: "License",
};

View File

@@ -1,38 +1,38 @@
import Key from '../i18nKey'
import type { Translation } from '../translation'
import Key from "../i18nKey";
import type { Translation } from "../translation";
export const es: Translation = {
[Key.home]: 'Inicio',
[Key.about]: 'Sobre mí',
[Key.archive]: 'Archivo',
[Key.search]: 'Buscar',
[Key.home]: "Inicio",
[Key.about]: "Sobre mí",
[Key.archive]: "Archivo",
[Key.search]: "Buscar",
[Key.tags]: 'Etiquetas',
[Key.categories]: 'Categorías',
[Key.recentPosts]: 'Publicaciones recientes',
[Key.tags]: "Etiquetas",
[Key.categories]: "Categorías",
[Key.recentPosts]: "Publicaciones recientes",
[Key.comments]: 'Comentarios',
[Key.comments]: "Comentarios",
[Key.untitled]: 'Sin título',
[Key.uncategorized]: 'Sin categoría',
[Key.noTags]: 'Sin etiquetas',
[Key.untitled]: "Sin título",
[Key.uncategorized]: "Sin categoría",
[Key.noTags]: "Sin etiquetas",
[Key.wordCount]: 'palabra',
[Key.wordsCount]: 'palabras',
[Key.minuteCount]: 'minuto',
[Key.minutesCount]: 'minutos',
[Key.postCount]: 'publicación',
[Key.postsCount]: 'publicaciones',
[Key.wordCount]: "palabra",
[Key.wordsCount]: "palabras",
[Key.minuteCount]: "minuto",
[Key.minutesCount]: "minutos",
[Key.postCount]: "publicación",
[Key.postsCount]: "publicaciones",
[Key.themeColor]: 'Color del tema',
[Key.themeColor]: "Color del tema",
[Key.lightMode]: 'Claro',
[Key.darkMode]: 'Oscuro',
[Key.systemMode]: 'Sistema',
[Key.lightMode]: "Claro",
[Key.darkMode]: "Oscuro",
[Key.systemMode]: "Sistema",
[Key.more]: 'Más',
[Key.more]: "Más",
[Key.author]: 'Autor',
[Key.publishedAt]: 'Publicado el',
[Key.license]: 'Licencia',
}
[Key.author]: "Autor",
[Key.publishedAt]: "Publicado el",
[Key.license]: "Licencia",
};

View File

@@ -1,38 +1,38 @@
import Key from '../i18nKey'
import type { Translation } from '../translation'
import Key from "../i18nKey";
import type { Translation } from "../translation";
export const ja: Translation = {
[Key.home]: 'Home',
[Key.about]: 'About',
[Key.archive]: 'Archive',
[Key.search]: '検索',
[Key.home]: "Home",
[Key.about]: "About",
[Key.archive]: "Archive",
[Key.search]: "検索",
[Key.tags]: 'タグ',
[Key.categories]: 'カテゴリ',
[Key.recentPosts]: '最近の投稿',
[Key.tags]: "タグ",
[Key.categories]: "カテゴリ",
[Key.recentPosts]: "最近の投稿",
[Key.comments]: 'コメント',
[Key.comments]: "コメント",
[Key.untitled]: 'タイトルなし',
[Key.uncategorized]: 'カテゴリなし',
[Key.noTags]: 'タグなし',
[Key.untitled]: "タイトルなし",
[Key.uncategorized]: "カテゴリなし",
[Key.noTags]: "タグなし",
[Key.wordCount]: '文字',
[Key.wordsCount]: '文字',
[Key.minuteCount]: '分',
[Key.minutesCount]: '分',
[Key.postCount]: '件の投稿',
[Key.postsCount]: '件の投稿',
[Key.wordCount]: "文字",
[Key.wordsCount]: "文字",
[Key.minuteCount]: "分",
[Key.minutesCount]: "分",
[Key.postCount]: "件の投稿",
[Key.postsCount]: "件の投稿",
[Key.themeColor]: 'テーマカラー',
[Key.themeColor]: "テーマカラー",
[Key.lightMode]: 'ライト',
[Key.darkMode]: 'ダーク',
[Key.systemMode]: 'システム',
[Key.lightMode]: "ライト",
[Key.darkMode]: "ダーク",
[Key.systemMode]: "システム",
[Key.more]: 'もっと',
[Key.more]: "もっと",
[Key.author]: '作者',
[Key.publishedAt]: '公開日',
[Key.license]: 'ライセンス',
}
[Key.author]: "作者",
[Key.publishedAt]: "公開日",
[Key.license]: "ライセンス",
};

View File

@@ -1,38 +1,38 @@
import Key from '../i18nKey'
import type { Translation } from '../translation'
import Key from "../i18nKey";
import type { Translation } from "../translation";
export const ko: Translation = {
[Key.home]: '홈',
[Key.about]: '소개',
[Key.archive]: '아카이브',
[Key.search]: '검색',
[Key.home]: "홈",
[Key.about]: "소개",
[Key.archive]: "아카이브",
[Key.search]: "검색",
[Key.tags]: '태그',
[Key.categories]: '카테고리',
[Key.recentPosts]: '최근 게시물',
[Key.tags]: "태그",
[Key.categories]: "카테고리",
[Key.recentPosts]: "최근 게시물",
[Key.comments]: '댓글',
[Key.comments]: "댓글",
[Key.untitled]: '제목 없음',
[Key.uncategorized]: '분류되지 않음',
[Key.noTags]: '태그 없음',
[Key.untitled]: "제목 없음",
[Key.uncategorized]: "분류되지 않음",
[Key.noTags]: "태그 없음",
[Key.wordCount]: '단어',
[Key.wordsCount]: '단어',
[Key.minuteCount]: '분',
[Key.minutesCount]: '분',
[Key.postCount]: '게시물',
[Key.postsCount]: '게시물',
[Key.wordCount]: "단어",
[Key.wordsCount]: "단어",
[Key.minuteCount]: "분",
[Key.minutesCount]: "분",
[Key.postCount]: "게시물",
[Key.postsCount]: "게시물",
[Key.themeColor]: '테마 색상',
[Key.themeColor]: "테마 색상",
[Key.lightMode]: '밝은 모드',
[Key.darkMode]: '어두운 모드',
[Key.systemMode]: '시스템 모드',
[Key.lightMode]: "밝은 모드",
[Key.darkMode]: "어두운 모드",
[Key.systemMode]: "시스템 모드",
[Key.more]: '더 보기',
[Key.more]: "더 보기",
[Key.author]: '저자',
[Key.publishedAt]: '게시일',
[Key.license]: '라이선스',
}
[Key.author]: "저자",
[Key.publishedAt]: "게시일",
[Key.license]: "라이선스",
};

View File

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

View File

@@ -1,38 +1,38 @@
import Key from '../i18nKey'
import type { Translation } from '../translation'
import Key from "../i18nKey";
import type { Translation } from "../translation";
export const zh_CN: Translation = {
[Key.home]: '主页',
[Key.about]: '关于',
[Key.archive]: '归档',
[Key.search]: '搜索',
[Key.home]: "主页",
[Key.about]: "关于",
[Key.archive]: "归档",
[Key.search]: "搜索",
[Key.tags]: '标签',
[Key.categories]: '分类',
[Key.recentPosts]: '最新文章',
[Key.tags]: "标签",
[Key.categories]: "分类",
[Key.recentPosts]: "最新文章",
[Key.comments]: '评论',
[Key.comments]: "评论",
[Key.untitled]: '无标题',
[Key.uncategorized]: '未分类',
[Key.noTags]: '无标签',
[Key.untitled]: "无标题",
[Key.uncategorized]: "未分类",
[Key.noTags]: "无标签",
[Key.wordCount]: '字',
[Key.wordsCount]: '字',
[Key.minuteCount]: '分钟',
[Key.minutesCount]: '分钟',
[Key.postCount]: '篇文章',
[Key.postsCount]: '篇文章',
[Key.wordCount]: "字",
[Key.wordsCount]: "字",
[Key.minuteCount]: "分钟",
[Key.minutesCount]: "分钟",
[Key.postCount]: "篇文章",
[Key.postsCount]: "篇文章",
[Key.themeColor]: '主题色',
[Key.themeColor]: "主题色",
[Key.lightMode]: '亮色',
[Key.darkMode]: '暗色',
[Key.systemMode]: '跟随系统',
[Key.lightMode]: "亮色",
[Key.darkMode]: "暗色",
[Key.systemMode]: "跟随系统",
[Key.more]: '更多',
[Key.more]: "更多",
[Key.author]: '作者',
[Key.publishedAt]: '发布于',
[Key.license]: '许可协议',
}
[Key.author]: "作者",
[Key.publishedAt]: "发布于",
[Key.license]: "许可协议",
};

View File

@@ -1,38 +1,38 @@
import Key from '../i18nKey'
import type { Translation } from '../translation'
import Key from "../i18nKey";
import type { Translation } from "../translation";
export const zh_TW: Translation = {
[Key.home]: '首頁',
[Key.about]: '關於',
[Key.archive]: '彙整',
[Key.search]: '搜尋',
[Key.home]: "首頁",
[Key.about]: "關於",
[Key.archive]: "彙整",
[Key.search]: "搜尋",
[Key.tags]: '標籤',
[Key.categories]: '分類',
[Key.recentPosts]: '最新文章',
[Key.tags]: "標籤",
[Key.categories]: "分類",
[Key.recentPosts]: "最新文章",
[Key.comments]: '評論',
[Key.comments]: "評論",
[Key.untitled]: '無標題',
[Key.uncategorized]: '未分類',
[Key.noTags]: '無標籤',
[Key.untitled]: "無標題",
[Key.uncategorized]: "未分類",
[Key.noTags]: "無標籤",
[Key.wordCount]: '字',
[Key.wordsCount]: '字',
[Key.minuteCount]: '分鐘',
[Key.minutesCount]: '分鐘',
[Key.postCount]: '篇文章',
[Key.postsCount]: '篇文章',
[Key.wordCount]: "字",
[Key.wordsCount]: "字",
[Key.minuteCount]: "分鐘",
[Key.minutesCount]: "分鐘",
[Key.postCount]: "篇文章",
[Key.postsCount]: "篇文章",
[Key.themeColor]: '主題色',
[Key.themeColor]: "主題色",
[Key.lightMode]: '亮色',
[Key.darkMode]: '暗色',
[Key.systemMode]: '跟隨系統',
[Key.lightMode]: "亮色",
[Key.darkMode]: "暗色",
[Key.systemMode]: "跟隨系統",
[Key.more]: '更多',
[Key.more]: "更多",
[Key.author]: '作者',
[Key.publishedAt]: '發佈於',
[Key.license]: '許可協議',
}
[Key.author]: "作者",
[Key.publishedAt]: "發佈於",
[Key.license]: "許可協議",
};

View File

@@ -1,40 +1,40 @@
import { siteConfig } from '../config'
import type I18nKey from './i18nKey'
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'
import { siteConfig } from "../config";
import type I18nKey from "./i18nKey";
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";
export type Translation = {
[K in I18nKey]: string
}
[K in I18nKey]: string;
};
const defaultTranslation = en
const defaultTranslation = en;
const map: { [key: string]: Translation } = {
es: es,
en: en,
en_us: en,
en_gb: en,
en_au: en,
zh_cn: zh_CN,
zh_tw: zh_TW,
ja: ja,
ja_jp: ja,
ko: ko,
ko_kr: ko,
th: th,
th_th: th,
}
es: es,
en: en,
en_us: en,
en_gb: en,
en_au: en,
zh_cn: zh_CN,
zh_tw: zh_TW,
ja: ja,
ja_jp: ja,
ko: ko,
ko_kr: ko,
th: th,
th_th: th,
};
export function getTranslation(lang: string): Translation {
return map[lang.toLowerCase()] || defaultTranslation
return map[lang.toLowerCase()] || defaultTranslation;
}
export function i18n(key: I18nKey): string {
const lang = siteConfig.lang || 'en'
return getTranslation(lang)[key]
const lang = siteConfig.lang || "en";
return getTranslation(lang)[key];
}