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: add invalid package name message translation #357

Merged
merged 2 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ async function init() {
type: () => (isValidPackageName(targetDir) ? null : 'text'),
message: language.packageName.message,
initial: () => toValidPackageName(targetDir),
validate: (dir) => isValidPackageName(dir) || 'Invalid package.json name'
validate: (dir) => isValidPackageName(dir) || language.packageName.invalidMessage
},
{
name: 'needsTypeScript',
Expand Down
3 changes: 2 additions & 1 deletion locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"message": "is not empty. Remove existing files and continue?"
},
"packageName": {
"message": "Package name:"
"message": "Package name:",
"invalidMessage": "Invalid package.json name"
},
"needsTypeScript": {
"message": "Add TypeScript?"
Expand Down
3 changes: 2 additions & 1 deletion locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"message": "n'est pas vide. Supprimer les fichiers existants et continuer\u00a0?"
},
"packageName": {
"message": "Nom du package\u00a0:"
"message": "Nom du package\u00a0:",
"invalidMessage": "Invalide package.json nom du"
btea marked this conversation as resolved.
Show resolved Hide resolved
},
"needsTypeScript": {
"message": "Ajouter TypeScript\u00a0?"
Expand Down
3 changes: 2 additions & 1 deletion locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"message": "非空,是否覆盖?"
},
"packageName": {
"message": "请输入包名称:"
"message": "请输入包名称:",
"invalidMessage": "无效的 package.json 名称"
},
"needsTypeScript": {
"message": "是否使用 TypeScript 语法?"
Expand Down
1 change: 1 addition & 0 deletions utils/getLanguage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as path from 'node:path'

interface LanguageItem {
message: string
invalidMessage?: string
dirForPrompts?: {
current: string
target: string
Expand Down