From 4c9c6c811eaffb633a1695cffd6accc7b691bb46 Mon Sep 17 00:00:00 2001 From: kabrunko-dev Date: Mon, 15 Jan 2024 10:40:59 -0300 Subject: [PATCH 1/2] feat: enhance readme i18n details collapsible --- scripts/locales/en.json | 2 ++ scripts/locales/ja.json | 2 ++ scripts/locales/ko.json | 2 ++ scripts/locales/zh-CN.json | 2 ++ scripts/readme.ts | 8 ++++++-- 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/scripts/locales/en.json b/scripts/locales/en.json index a83ffa55b..e767aa7dd 100644 --- a/scripts/locales/en.json +++ b/scripts/locales/en.json @@ -4,6 +4,8 @@ "badge.share-your-solutions": "Share your Solutions", "badge.take-the-challenge": "Take the Challenge", "badge.preview-playground": "Preview in Playground", + "details.by-tags": "By Tags", + "details.by-plain-text": "By Plain Text", "difficulty.easy": "easy", "difficulty.extreme": "extreme", "difficulty.hard": "hard", diff --git a/scripts/locales/ja.json b/scripts/locales/ja.json index 039cb897a..af96ce2fa 100644 --- a/scripts/locales/ja.json +++ b/scripts/locales/ja.json @@ -4,6 +4,8 @@ "badge.preview-playground": "Playgroundでプレビュー", "badge.share-your-solutions": "解答を共有", "badge.take-the-challenge": "挑戦する", + "details.by-tags": "By Tags", + "details.by-plain-text": "By Plain Text", "difficulty.easy": "初級", "difficulty.extreme": "最上級", "difficulty.hard": "上級", diff --git a/scripts/locales/ko.json b/scripts/locales/ko.json index 4c9201d69..9f0df38ca 100644 --- a/scripts/locales/ko.json +++ b/scripts/locales/ko.json @@ -4,6 +4,8 @@ "badge.share-your-solutions": "정답 공유하기", "badge.take-the-challenge": "도전하기", "badge.preview-playground": "Playground에서 미리보기", + "details.by-tags": "By Tags", + "details.by-plain-text": "By Plain Text", "difficulty.easy": "쉬움", "difficulty.extreme": "매우 어려움", "difficulty.hard": "어려움", diff --git a/scripts/locales/zh-CN.json b/scripts/locales/zh-CN.json index e6dc881a4..6925287c9 100644 --- a/scripts/locales/zh-CN.json +++ b/scripts/locales/zh-CN.json @@ -4,6 +4,8 @@ "badge.share-your-solutions": "分享你的解答", "badge.take-the-challenge": "接受挑战", "badge.preview-playground": "在 Playground 中预览", + "details.by-tags": "By Tags", + "details.by-plain-text": "By Plain Text", "difficulty.easy": "简单", "difficulty.extreme": "地狱", "difficulty.hard": "困难", diff --git a/scripts/readme.ts b/scripts/readme.ts index 7bc6695ad..1dab9fc62 100644 --- a/scripts/readme.ts +++ b/scripts/readme.ts @@ -64,6 +64,10 @@ function toDifficultyPlainText(difficulty: string, locale: SupportedLocale, coun return `${t(locale, `difficulty.${difficulty}`)} (${count.toString()})` } +function toDetailsInnerText(text: string, locale: SupportedLocale) { + return `${t(locale, `details.${text}`)}` +} + function quizToBadge(quiz: Quiz, locale: string, absolute = false, badge = true) { const fn = badge ? toBadgeLink : toPlanTextLink return fn( @@ -162,7 +166,7 @@ async function updateIndexREADME(quizes: Quiz[]) { } // by tags - challengesREADME += '
By Tags
' + challengesREADME += `
${toDetailsInnerText('by-tags', locale)}
` const tags = getAllTags(quizes, locale) for (const tag of tags) { challengesREADME += `
${toBadge('', `#${tag}`, '999')}` @@ -177,7 +181,7 @@ async function updateIndexREADME(quizes: Quiz[]) { // by plain text prev = '' - challengesREADME += '
By Plain Text
' + challengesREADME += `
${toDetailsInnerText('by-plain-text', locale)}
` for (const quiz of quizesByDifficulty) { if (prev !== quiz.difficulty) challengesREADME += `${prev ? '' : ''}

${toDifficultyPlainText(quiz.difficulty, locale, quizesByDifficulty.filter(q => q.difficulty === quiz.difficulty).length)}

    ` From ffbf7dcc7223139840bb1c6b6d4b30933d212d7b Mon Sep 17 00:00:00 2001 From: kabrunko-dev Date: Mon, 15 Jan 2024 13:32:43 -0300 Subject: [PATCH 2/2] chore: update details collapsible text i18n --- scripts/locales/ja.json | 4 ++-- scripts/locales/ko.json | 4 ++-- scripts/locales/pt-BR.json | 2 ++ scripts/locales/zh-CN.json | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/locales/ja.json b/scripts/locales/ja.json index af96ce2fa..3c64328a5 100644 --- a/scripts/locales/ja.json +++ b/scripts/locales/ja.json @@ -4,8 +4,8 @@ "badge.preview-playground": "Playgroundでプレビュー", "badge.share-your-solutions": "解答を共有", "badge.take-the-challenge": "挑戦する", - "details.by-tags": "By Tags", - "details.by-plain-text": "By Plain Text", + "details.by-tags": "タグ別", + "details.by-plain-text": "プレーンテキストによる", "difficulty.easy": "初級", "difficulty.extreme": "最上級", "difficulty.hard": "上級", diff --git a/scripts/locales/ko.json b/scripts/locales/ko.json index 9f0df38ca..e1aa3dcdd 100644 --- a/scripts/locales/ko.json +++ b/scripts/locales/ko.json @@ -4,8 +4,8 @@ "badge.share-your-solutions": "정답 공유하기", "badge.take-the-challenge": "도전하기", "badge.preview-playground": "Playground에서 미리보기", - "details.by-tags": "By Tags", - "details.by-plain-text": "By Plain Text", + "details.by-tags": "태그별", + "details.by-plain-text": "일반 텍스트로", "difficulty.easy": "쉬움", "difficulty.extreme": "매우 어려움", "difficulty.hard": "어려움", diff --git a/scripts/locales/pt-BR.json b/scripts/locales/pt-BR.json index acc2c2bcc..3ec043c24 100644 --- a/scripts/locales/pt-BR.json +++ b/scripts/locales/pt-BR.json @@ -4,6 +4,8 @@ "badge.share-your-solutions": "Compartilhar suas Soluções", "badge.take-the-challenge": "Fazer o Desafio", "badge.preview-playground": "Pré-visualizar no Playground", + "details.by-tags": "Por Tags", + "details.by-plain-text": "Por Texto Simples", "difficulty.easy": "fácil", "difficulty.extreme": "extremo", "difficulty.hard": "difícil", diff --git a/scripts/locales/zh-CN.json b/scripts/locales/zh-CN.json index 6925287c9..4edc3e95d 100644 --- a/scripts/locales/zh-CN.json +++ b/scripts/locales/zh-CN.json @@ -4,8 +4,8 @@ "badge.share-your-solutions": "分享你的解答", "badge.take-the-challenge": "接受挑战", "badge.preview-playground": "在 Playground 中预览", - "details.by-tags": "By Tags", - "details.by-plain-text": "By Plain Text", + "details.by-tags": "按标签", + "details.by-plain-text": "通过纯文本", "difficulty.easy": "简单", "difficulty.extreme": "地狱", "difficulty.hard": "困难",