Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lang): add turkish language #2185

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ import { getRequestConfig } from "next-intl/server"

import { Language } from "./lib/types"

export const locales: Language[] = ["en", "ja", "zh", "zh-TW"]
export const locales: Language[] = ["en", "ja", "zh", "zh-TW", "tr"]
export const languageNames: Record<(typeof locales)[number], string> = {
en: "English",
ja: "Japanese",
zh: "Chinese (Simplified)",
"zh-TW": "Chinese (Traditional)",
tr: "Turkish",
}
export const nameMap: Record<string, string> = {
en: "English",
zh: "简体中文",
"zh-TW": "繁體中文",
ja: "日本語",
tr: "Turkish",
}
export const defaultLocale = "en"

Expand Down
2 changes: 2 additions & 0 deletions src/lib/detect-lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const _thresholds: Thresholds = {
en: 0.8,
zh: 0.3,
ja: 0.5,
tr: 0.7,
}

export function detectLanguage(
Expand Down Expand Up @@ -48,6 +49,7 @@ export function detectLanguage(
en: XRegExp("\\p{Latin}", "gi"),
zh: XRegExp("\\p{Han}", "gi"),
ja: XRegExp("[\\p{Hiragana}\\p{Katakana}]", "gi"),
tr: XRegExp("[\\p{Latin}&&[^\\p{Common}]]", "gi"),
}

for (const [lang, regex] of Object.entries(regexes)) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CharacterEntity, NoteEntity } from "crossbell"
import type { BundledTheme } from "shiki/themes"

export type Language = Readonly<"en" | "zh" | "zh-TW" | "ja">
export type Language = Readonly<"en" | "zh" | "zh-TW" | "ja" | "tr">

export type Site = {
id: string
Expand Down
1 change: 1 addition & 0 deletions src/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"ja": "Japanese",
"zh": "Chinese",
"zh-TW": "Traditional Chinese",
"tr": "Turkish",
"Confirmed by {blockNumber} blocks": "Confirmed by {blockNumber} blocks",
"Become a patron of {name}": "Become a patron of {name}"
}
3 changes: 2 additions & 1 deletion src/messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,6 @@
"en": "英語",
"ja": "日本語",
"zh": "中国語",
"zh-TW": "繁体字中国語"
"zh-TW": "繁体字中国語",
"tr": "トルコ語"
}
441 changes: 441 additions & 0 deletions src/messages/tr.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/messages/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@
"ja": "日文",
"zh": "簡體中文",
"zh-TW": "繁體中文",
"tr": "土耳其文",
"New Post": "新增文章",
"New Page": "新增頁面",
"New Portfolio": "新增作品",
Expand Down
3 changes: 2 additions & 1 deletion src/messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"Latest patrons": "最近赞助者",
"Latest tipper": "最近赞赏者",
"You are here to be the first patron": "你将是第一个赞助者。",
"You are here to be the first tipper": "你将是第一个赞赏者。",
"You are here to be the first tipper": "Bunu ilk takdir eden siz olacaksınız. ",
OsmanTunahan marked this conversation as resolved.
Show resolved Hide resolved
"Select a tier": "选择一个等级",
"One-time": "一次性",
"Monthly and NFT Rewards": "每月和 NFT 奖励",
Expand Down Expand Up @@ -434,6 +434,7 @@
"ja": "日语",
"zh": "中文",
"zh-TW": "繁体中文",
"tr": "土耳其语",
"Footer": "页脚",
"Support Markdown": "支持 Markdown",
"on-chain posting on": "条链上发布于"
Expand Down