chore: fix typos (#36619)

This commit is contained in:
Noritaka Kobayashi 2025-06-02 18:28:30 +09:00 committed by GitHub
parent 20e6abfc0c
commit cba6405d3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
21 changed files with 75 additions and 75 deletions

View File

@ -5,7 +5,7 @@
例えば
```ts
type trimed = TrimLeft<' Hello World '> // expected to be 'Hello World '
type trimmed = TrimLeft<' Hello World '> // expected to be 'Hello World '
```

View File

@ -5,7 +5,7 @@
예시
```ts
type trimed = TrimLeft<' Hello World '> // 기대되는 결과는 'Hello World '입니다.
type trimmed = TrimLeft<' Hello World '> // 기대되는 결과는 'Hello World '입니다.
```

View File

@ -5,7 +5,7 @@ Implement `TrimLeft<T>` which takes an exact string type and returns a new strin
For example
```ts
type trimed = TrimLeft<' Hello World '> // expected to be 'Hello World '
type trimmed = TrimLeft<' Hello World '> // expected to be 'Hello World '
```

View File

@ -5,7 +5,7 @@
例如
```ts
type trimed = TrimLeft<' Hello World '> // 应推导出 'Hello World '
type trimmed = TrimLeft<' Hello World '> // 应推导出 'Hello World '
```
<!--info-footer-start--><br><a href="../../README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-%E8%BF%94%E5%9B%9E%E9%A6%96%E9%A1%B5-grey" alt="返回首页"/></a> <a href="https://tsch.js.org/106/answer/zh-CN" target="_blank"><img src="https://img.shields.io/badge/-%E5%88%86%E4%BA%AB%E4%BD%A0%E7%9A%84%E8%A7%A3%E7%AD%94-teal" alt="分享你的解答"/></a> <a href="https://tsch.js.org/106/solutions" target="_blank"><img src="https://img.shields.io/badge/-%E6%9F%A5%E7%9C%8B%E8%A7%A3%E7%AD%94-de5a77?logo=awesome-lists&logoColor=white" alt="查看解答"/></a> <hr><h3>相关挑战</h3><a href="https://github.com/type-challenges/type-challenges/blob/main/questions/00108-medium-trim/README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-108%E3%83%BB%E5%8E%BB%E9%99%A4%E4%B8%A4%E7%AB%AF%E7%A9%BA%E7%99%BD%E5%AD%97%E7%AC%A6-d9901a" alt="108・去除两端空白字符"/></a> <a href="https://github.com/type-challenges/type-challenges/blob/main/questions/04803-medium-trim-right/README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-4803%E3%83%BBTrim%20Right-d9901a" alt="4803・Trim Right"/></a> <!--info-footer-end-->

View File

@ -5,7 +5,7 @@
例えば
```ts
type trimed = Trim<' Hello World '> // expected to be 'Hello World'
type trimmed = Trim<' Hello World '> // expected to be 'Hello World'
```

View File

@ -5,7 +5,7 @@
例如
```ts
type trimed = Trim<' Hello World '> // expected to be 'Hello World'
type trimmed = Trim<' Hello World '> // expected to be 'Hello World'
```

View File

@ -1,6 +1,6 @@
<!--info-header-start--><h1>Absolute <img src="https://img.shields.io/badge/-%E4%B8%AD%E7%B4%9A-d9901a" alt="中級"/> <img src="https://img.shields.io/badge/-%23math-999" alt="#math"/> <img src="https://img.shields.io/badge/-%23template--literal-999" alt="#template-literal"/></h1><blockquote><p>by Andrey Krasovsky <a href="https://github.com/bre30kra69cs" target="_blank">@bre30kra69cs</a></p></blockquote><p><a href="https://tsch.js.org/529/play/ja" target="_blank"><img src="https://img.shields.io/badge/-%E6%8C%91%E6%88%A6%E3%81%99%E3%82%8B-3178c6?logo=typescript&logoColor=white" alt="挑戦する"/></a> &nbsp;&nbsp;&nbsp;<a href="./README.md" target="_blank"><img src="https://img.shields.io/badge/-English-gray" alt="English"/></a> <a href="./README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-gray" alt="简体中文"/></a> <a href="./README.ko.md" target="_blank"><img src="https://img.shields.io/badge/-%ED%95%9C%EA%B5%AD%EC%96%B4-gray" alt="한국어"/></a> </p><!--info-header-end-->
srting, number または bigint を受け取り、正の数を出力する `Absolute` 型を実装します。
string, number または bigint を受け取り、正の数を出力する `Absolute` 型を実装します。
例えば

View File

@ -5,7 +5,7 @@
예시
```ts
type Trimed = TrimRight<' Hello World '> // 기대되는 결과는 ' Hello World'입니다.
type Trimmed = TrimRight<' Hello World '> // 기대되는 결과는 ' Hello World'입니다.
```

View File

@ -5,7 +5,7 @@ Implement `TrimRight<T>` which takes an exact string type and returns a new stri
For example:
```ts
type Trimed = TrimRight<' Hello World '> // expected to be ' Hello World'
type Trimmed = TrimRight<' Hello World '> // expected to be ' Hello World'
```

View File

@ -6,7 +6,7 @@
例如
```ts
type Trimed = TrimRight<' Hello World '> // 应推导出 ' Hello World'
type Trimmed = TrimRight<' Hello World '> // 应推导出 ' Hello World'
```
<!--info-footer-start--><br><a href="../../README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-%E8%BF%94%E5%9B%9E%E9%A6%96%E9%A1%B5-grey" alt="返回首页"/></a> <a href="https://tsch.js.org/4803/answer/zh-CN" target="_blank"><img src="https://img.shields.io/badge/-%E5%88%86%E4%BA%AB%E4%BD%A0%E7%9A%84%E8%A7%A3%E7%AD%94-teal" alt="分享你的解答"/></a> <a href="https://tsch.js.org/4803/solutions" target="_blank"><img src="https://img.shields.io/badge/-%E6%9F%A5%E7%9C%8B%E8%A7%A3%E7%AD%94-de5a77?logo=awesome-lists&logoColor=white" alt="查看解答"/></a> <hr><h3>相关挑战</h3><a href="https://github.com/type-challenges/type-challenges/blob/main/questions/00106-medium-trimleft/README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-106%E3%83%BB%E5%8E%BB%E9%99%A4%E5%B7%A6%E4%BE%A7%E7%A9%BA%E7%99%BD-d9901a" alt="106・去除左侧空白"/></a> <a href="https://github.com/type-challenges/type-challenges/blob/main/questions/00108-medium-trim/README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-108%E3%83%BB%E5%8E%BB%E9%99%A4%E4%B8%A4%E7%AB%AF%E7%A9%BA%E7%99%BD%E5%AD%97%E7%AC%A6-d9901a" alt="108・去除两端空白字符"/></a> <!--info-footer-end-->

View File

@ -5,7 +5,7 @@ Construct a tuple with a given length.
For example
```ts
type result = ConstructTuple<2> // expect to be [unknown, unkonwn]
type result = ConstructTuple<2> // expect to be [unknown, unknown]
```

View File

@ -5,7 +5,7 @@
例如
```ts
type result = ConstructTuple<2> // 期望得到 [unknown, unkonwn]
type result = ConstructTuple<2> // 期望得到 [unknown, unknown]
```

View File

@ -1,6 +1,6 @@
<!--info-header-start--><h1>Appear only once <img src="https://img.shields.io/badge/-medium-d9901a" alt="medium"/> </h1><blockquote><p>by X.Q. Chen <a href="https://github.com/brenner8023" target="_blank">@brenner8023</a></p></blockquote><p><a href="https://tsch.js.org/9898/play" target="_blank"><img src="https://img.shields.io/badge/-Take%20the%20Challenge-3178c6?logo=typescript&logoColor=white" alt="Take the Challenge"/></a> &nbsp;&nbsp;&nbsp;<a href="./README.zh-CN.md" target="_blank"><img src="https://img.shields.io/badge/-%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87-gray" alt="简体中文"/></a> </p><!--info-header-end-->
Find the elements in the target array that appear only once. For exampleinput: `[1,2,2,3,3,4,5,6,6,6]`ouput: `[1,4,5]`.
Find the elements in the target array that appear only once. For exampleinput: `[1,2,2,3,3,4,5,6,6,6]`output: `[1,4,5]`.
<!--info-footer-start--><br><a href="../../README.md" target="_blank"><img src="https://img.shields.io/badge/-Back-grey" alt="Back"/></a> <a href="https://tsch.js.org/9898/answer" target="_blank"><img src="https://img.shields.io/badge/-Share%20your%20Solutions-teal" alt="Share your Solutions"/></a> <a href="https://tsch.js.org/9898/solutions" target="_blank"><img src="https://img.shields.io/badge/-Check%20out%20Solutions-de5a77?logo=awesome-lists&logoColor=white" alt="Check out Solutions"/></a> <!--info-footer-end-->

View File

@ -1,6 +1,6 @@
<!--info-header-start--><h1>BitwiseXOR <img src="https://img.shields.io/badge/-hard-de3d37" alt="hard"/> </h1><blockquote><p>by jiangshan <a href="https://github.com/jiangshanmeta" target="_blank">@jiangshanmeta</a></p></blockquote><p><a href="https://tsch.js.org/30575/play" target="_blank"><img src="https://img.shields.io/badge/-Take%20the%20Challenge-3178c6?logo=typescript&logoColor=white" alt="Take the Challenge"/></a> </p><!--info-header-end-->
Implement ```BitwiseXOR<S1,S2>``` which takes two binary string literal type and returns a binary string that reprents the bitwise XOR of S1 and S2
<!--info-header-start--><h1>BitwiseXOR <img src="https://img.shields.io/badge/-hard-de3d37" alt="hard"/> </h1><blockquote><p>by jiangshan <a href="https://github.com/jiangshanmeta" target="_blank">@jiangshanmeta</a></p></blockquote><p><a href="https://tsch.js.org/30575/play" target="_blank"><img src="https://img.shields.io/badge/-Take%20the%20Challenge-3178c6?logo=typescript&logoColor=white" alt="Take the Challenge"/></a> </p><!--info-header-end-->
Implement ```BitwiseXOR<S1,S2>``` which takes two binary string literal type and returns a binary string that represents the bitwise XOR of S1 and S2
For example:
@ -8,7 +8,7 @@ For example:
BitwiseXOR<'0','1'> // expect '1'
BitwiseXOR<'1','1'> // expect '0'
BitwiseXOR<'10','1'> // expect '11'
```
```
<!--info-footer-start--><br><a href="../../README.md" target="_blank"><img src="https://img.shields.io/badge/-Back-grey" alt="Back"/></a> <a href="https://tsch.js.org/30575/answer" target="_blank"><img src="https://img.shields.io/badge/-Share%20your%20Solutions-teal" alt="Share your Solutions"/></a> <a href="https://tsch.js.org/30575/solutions" target="_blank"><img src="https://img.shields.io/badge/-Check%20out%20Solutions-de5a77?logo=awesome-lists&logoColor=white" alt="Check out Solutions"/></a> <!--info-footer-end-->

View File

@ -1,5 +1,5 @@
import type { Equal, Expect } from '@type-challenges/utils'
type cases = [
// Base cases
Expect<Equal<Unbox<number>, number>>,
@ -13,7 +13,7 @@ type cases = [
// Bonus: Recursion
Expect<Equal<Unbox<() => Promise<() => Array<Promise<boolean>>>>, boolean>>,
// Bonus: Recusion levels
// Bonus: Recursion levels
Expect<Equal<Unbox<() => () => () => () => number, 0>, number>>,
Expect<Equal<Unbox<() => () => () => () => number, 1>, () => () => () => number>>,
Expect<Equal<Unbox<() => () => () => () => number, 2>, () => () => number>>,
@ -37,4 +37,4 @@ type cases = [
Expect<Equal<Unbox<Promise<Promise<Promise<number>>>, 2>, Promise<number>>>,
Expect<Equal<Unbox<Promise<Promise<Promise<number>>>, 3>, number>>,
Expect<Equal<Unbox<Promise<Promise<Promise<number>>>, 4>, number>>,
]
]

View File

@ -1,12 +1,12 @@
import path from 'node:path'
import fs from 'fs-extra'
import { loadQuizes, resolveInfo } from './loader'
import { loadQuizzes, resolveInfo } from './loader'
import { REPO, toPlaygroundUrl, toQuestionsRawREADME, toQuizREADME, toRawREADME, toShareAnswerFull, toSolutionsFull } from './toUrl'
import { defaultLocale, supportedLocales } from './locales'
import { formatToCode } from './actions/utils/formatToCode'
export async function build() {
const quizes = await loadQuizes()
const quizzes = await loadQuizzes()
const redirects: [string, string, number][] = []
// redirect homepage to github repo
@ -18,7 +18,7 @@ export async function build() {
redirects.push([`/raw/${locale}`, toQuestionsRawREADME(locale), 302])
})
for (const quiz of quizes) {
for (const quiz of quizzes) {
for (const locale of supportedLocales) {
const info = resolveInfo(quiz, locale)

View File

@ -5,7 +5,7 @@ import fs from 'fs-extra'
import c from 'ansis'
import prompts from 'prompts'
import { formatToCode } from './actions/utils/formatToCode'
import { loadQuizes, resolveInfo } from './loader'
import { loadQuizzes, resolveInfo } from './loader'
import { supportedLocales } from './locales'
import { getQuestionFullName } from './actions/issue-pr'
import type { QuizMetaInfo } from './types'
@ -32,14 +32,14 @@ function calculateFileHash(filePathFull: string): Promise<string> {
})
}
async function takeSnapshot(quizesPath: string) {
async function takeSnapshot(quizzesPath: string) {
let snapshot: Snapshot = {}
const files = fs.readdirSync(quizesPath)
const files = fs.readdirSync(quizzesPath)
for (const file of files) {
// Might be a file, or a folder
const fPath = path.join(quizesPath, file)
const fPath = path.join(quizzesPath, file)
const fStats = fs.statSync(fPath)
if (fStats.isDirectory()) {
@ -142,10 +142,10 @@ async function generatePlayground() {
await fs.ensureDir(playgroundPath)
}
const quizes = await loadQuizes()
const incomingQuizesCache: Snapshot = {}
const quizzes = await loadQuizzes()
const incomingQuizzesCache: Snapshot = {}
for (const quiz of quizes) {
for (const quiz of quizzes) {
const { difficulty, title } = resolveInfo(quiz, locale) as QuizMetaInfo & { difficulty: string }
const code = formatToCode(quiz, locale)
@ -154,22 +154,22 @@ async function generatePlayground() {
continue
}
const quizesPathByDifficulty = path.join(playgroundPath, difficulty)
const quizzesPathByDifficulty = path.join(playgroundPath, difficulty)
const quizFileName = `${getQuestionFullName(quiz.no, difficulty, title)}.ts`
const quizPathFull = path.join(quizesPathByDifficulty, quizFileName)
const quizPathFull = path.join(quizzesPathByDifficulty, quizFileName)
if (!keepChanges || (keepChanges && isQuizWritable(quizFileName, overridableFiles!, playgroundSnapshot!))) {
if (!fs.existsSync(quizesPathByDifficulty))
fs.mkdirSync(quizesPathByDifficulty)
if (!fs.existsSync(quizzesPathByDifficulty))
fs.mkdirSync(quizzesPathByDifficulty)
await fs.writeFile(quizPathFull, code, 'utf-8')
incomingQuizesCache[quizFileName] = await calculateFileHash(quizPathFull)
incomingQuizzesCache[quizFileName] = await calculateFileHash(quizPathFull)
}
}
fs.writeFile(playgroundCachePath, JSON.stringify({
...currentPlaygroundCache,
...incomingQuizesCache,
...incomingQuizzesCache,
}))
console.log()

View File

@ -67,17 +67,17 @@ export function loadInfo(s: string): Partial<QuizMetaInfo> | undefined {
export const QUIZ_ROOT = path.resolve(__dirname, '../questions')
export async function loadQuizes(): Promise<Quiz[]> {
export async function loadQuizzes(): Promise<Quiz[]> {
const folders = await fg('{0..9}*-*', {
onlyDirectories: true,
cwd: QUIZ_ROOT,
})
const quizes = await Promise.all(
const quizzes = await Promise.all(
folders.map(async dir => loadQuiz(dir)),
)
return quizes
return quizzes
}
export async function loadQuiz(dir: string): Promise<Quiz> {

View File

@ -3,7 +3,7 @@ import process from 'node:process'
import fs from 'fs-extra'
import type { SupportedLocale } from './locales'
import { defaultLocale, f, supportedLocales, t } from './locales'
import { loadQuizes, resolveInfo } from './loader'
import { loadQuizzes, resolveInfo } from './loader'
import { toAnswerShort, toNearborREADME, toPlayShort, toQuizREADME, toSolutionsShort } from './toUrl'
import type { Quiz, QuizMetaInfo } from './types'
@ -78,17 +78,17 @@ function quizToBadge(quiz: Quiz, locale: string, absolute = false, badge = true)
)
}
function quizNoToBadges(ids: (string | number)[], quizes: Quiz[], locale: string, absolute = false) {
function quizNoToBadges(ids: (string | number)[], quizzes: Quiz[], locale: string, absolute = false) {
return ids
.map(i => quizes.find(q => q.no === Number(i)))
.map(i => quizzes.find(q => q.no === Number(i)))
.filter(Boolean)
.map(i => quizToBadge(i!, locale, absolute))
.join(' ')
}
function getAllTags(quizes: Quiz[], locale: string) {
function getAllTags(quizzes: Quiz[], locale: string) {
const set = new Set<string>()
for (const quiz of quizes) {
for (const quiz of quizzes) {
const info = resolveInfo(quiz, locale)
for (const tag of (info?.tags || []))
set.add(tag as string)
@ -96,14 +96,14 @@ function getAllTags(quizes: Quiz[], locale: string) {
return Array.from(set).sort()
}
function getQuizesByTag(quizes: Quiz[], locale: string, tag: string) {
return quizes.filter((quiz) => {
function getQuizzesByTag(quizzes: Quiz[], locale: string, tag: string) {
return quizzes.filter((quiz) => {
const info = resolveInfo(quiz, locale)
return !!info.tags?.includes(tag)
})
}
async function insertInfoReadme(filepath: string, quiz: Quiz, locale: SupportedLocale, quizes: Quiz[]) {
async function insertInfoReadme(filepath: string, quiz: Quiz, locale: SupportedLocale, quizzes: Quiz[]) {
if (!fs.existsSync(filepath))
return
let text = await fs.readFile(filepath, 'utf-8')
@ -136,7 +136,7 @@ async function insertInfoReadme(filepath: string, quiz: Quiz, locale: SupportedL
+ toBadgeLink(`../../${f('README', locale, 'md')}`, '', t(locale, 'badge.back'), 'grey')
+ toBadgeLink(toAnswerShort(quiz.no, locale), '', t(locale, 'badge.share-your-solutions'), 'teal')
+ toBadgeLink(toSolutionsShort(quiz.no), '', t(locale, 'badge.checkout-solutions'), 'de5a77', '?logo=awesome-lists&logoColor=white')
+ (Array.isArray(info.related) && info.related.length ? `<hr><h3>${t(locale, 'readme.related-challenges')}</h3>${quizNoToBadges(info.related, quizes, locale, true)}` : '')
+ (Array.isArray(info.related) && info.related.length ? `<hr><h3>${t(locale, 'readme.related-challenges')}</h3>${quizNoToBadges(info.related, quizzes, locale, true)}` : '')
+ '<!--info-footer-end-->',
)
@ -145,7 +145,7 @@ async function insertInfoReadme(filepath: string, quiz: Quiz, locale: SupportedL
await fs.writeFile(filepath, text, 'utf-8')
}
async function updateIndexREADME(quizes: Quiz[]) {
async function updateIndexREADME(quizzes: Quiz[]) {
// update index README
for (const locale of supportedLocales) {
const filepath = path.resolve(__dirname, '..', f('README', locale, 'md'))
@ -154,11 +154,11 @@ async function updateIndexREADME(quizes: Quiz[]) {
let prev = ''
// difficulty
const quizesByDifficulty = [...quizes].sort((a, b) => DifficultyRank.indexOf(a.difficulty) - DifficultyRank.indexOf(b.difficulty))
const quizzesByDifficulty = [...quizzes].sort((a, b) => DifficultyRank.indexOf(a.difficulty) - DifficultyRank.indexOf(b.difficulty))
for (const quiz of quizesByDifficulty) {
for (const quiz of quizzesByDifficulty) {
if (prev !== quiz.difficulty)
challengesREADME += `${prev ? '<br><br>' : ''}${toDifficultyBadgeInverted(quiz.difficulty, locale, quizesByDifficulty.filter(q => q.difficulty === quiz.difficulty).length)}<br>`
challengesREADME += `${prev ? '<br><br>' : ''}${toDifficultyBadgeInverted(quiz.difficulty, locale, quizzesByDifficulty.filter(q => q.difficulty === quiz.difficulty).length)}<br>`
challengesREADME += quizToBadge(quiz, locale)
@ -167,10 +167,10 @@ async function updateIndexREADME(quizes: Quiz[]) {
// by tags
challengesREADME += `<br><details><summary>${toDetailsInnerText('by-tags', locale)}</summary><br><table><tbody>`
const tags = getAllTags(quizes, locale)
const tags = getAllTags(quizzes, locale)
for (const tag of tags) {
challengesREADME += `<tr><td>${toBadge('', `#${tag}`, '999')}</td><td>`
getQuizesByTag(quizesByDifficulty, locale, tag)
getQuizzesByTag(quizzesByDifficulty, locale, tag)
.forEach((quiz) => {
challengesREADME += quizToBadge(quiz, locale)
})
@ -182,9 +182,9 @@ async function updateIndexREADME(quizes: Quiz[]) {
// by plain text
prev = ''
challengesREADME += `<br><details><summary>${toDetailsInnerText('by-plain-text', locale)}</summary><br>`
for (const quiz of quizesByDifficulty) {
for (const quiz of quizzesByDifficulty) {
if (prev !== quiz.difficulty)
challengesREADME += `${prev ? '</ul>' : ''}<h3>${toDifficultyPlainText(quiz.difficulty, locale, quizesByDifficulty.filter(q => q.difficulty === quiz.difficulty).length)}</h3><ul>`
challengesREADME += `${prev ? '</ul>' : ''}<h3>${toDifficultyPlainText(quiz.difficulty, locale, quizzesByDifficulty.filter(q => q.difficulty === quiz.difficulty).length)}</h3><ul>`
challengesREADME += `<li>${quizToBadge(quiz, locale, false, false)}</li>`
prev = quiz.difficulty
}
@ -199,11 +199,11 @@ async function updateIndexREADME(quizes: Quiz[]) {
}
}
async function updateQuestionsREADME(quizes: Quiz[]) {
async function updateQuestionsREADME(quizzes: Quiz[]) {
const questionsDir = path.resolve(__dirname, '../questions')
// update each questions' readme
for (const quiz of quizes) {
for (const quiz of quizzes) {
for (const locale of supportedLocales) {
await insertInfoReadme(
path.join(
@ -213,26 +213,26 @@ async function updateQuestionsREADME(quizes: Quiz[]) {
),
quiz,
locale,
quizes,
quizzes,
)
}
}
}
export async function updateREADMEs(type?: 'quiz' | 'index') {
const quizes = await loadQuizes()
quizes.sort((a, b) => a.no - b.no)
const quizzes = await loadQuizzes()
quizzes.sort((a, b) => a.no - b.no)
if (type === 'quiz') {
await updateQuestionsREADME(quizes)
await updateQuestionsREADME(quizzes)
}
else if (type === 'index') {
await updateIndexREADME(quizes)
await updateIndexREADME(quizzes)
}
else {
await Promise.all([
updateIndexREADME(quizes),
updateQuestionsREADME(quizes),
updateIndexREADME(quizzes),
updateQuestionsREADME(quizzes),
])
}
}

View File

@ -1,11 +1,11 @@
import { updateREADMEs } from './readme'
import { translateAllQuizes } from './translate'
import { translateAllQuizzes } from './translate'
import { defaultLocale } from './locales'
async function run() {
await translateAllQuizes(defaultLocale, 'zh-CN')
await translateAllQuizes(defaultLocale, 'ja')
await translateAllQuizes(defaultLocale, 'pt-BR')
await translateAllQuizzes(defaultLocale, 'zh-CN')
await translateAllQuizzes(defaultLocale, 'ja')
await translateAllQuizzes(defaultLocale, 'pt-BR')
await updateREADMEs()
}

View File

@ -1,7 +1,7 @@
import path from 'node:path'
import fs from 'fs-extra'
import { translate } from '@vitalets/google-translate-api'
import { QUIZ_ROOT, loadQuizByNo, loadQuizes } from './loader'
import { QUIZ_ROOT, loadQuizByNo, loadQuizzes } from './loader'
import { resolveFilePath } from './utils/resolve'
import type { Quiz } from './types'
import type { SupportedLocale } from './locales'
@ -59,10 +59,10 @@ export async function translateMarkdown(code: string, from: SupportedLocale, to:
return result
}
export async function translateAllQuizes(from: SupportedLocale, to: SupportedLocale) {
const quizes = await loadQuizes()
export async function translateAllQuizzes(from: SupportedLocale, to: SupportedLocale) {
const quizzes = await loadQuizzes()
for (const quiz of quizes) {
for (const quiz of quizzes) {
if (quiz.readme[to] || !quiz.readme[from]) {
console.log(`Skipped #${quiz.no}`)
continue