Skip to content

Commit 13cc390

Browse files
fix bug
1 parent 170472c commit 13cc390

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

inlang/packages/sherlock/src/commands/extractMessage.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,19 @@ export const extractMessageCommand = {
8383
: "none"
8484
}
8585

86+
const isKnownGenerator = Object.hasOwn(generators, generator)
87+
const generatedValue = isKnownGenerator
88+
? generators[generator as keyof typeof generators]()
89+
: ""
90+
const showRandomNamesTip = generator !== "none"
91+
8692
const bundleId = await window.showInputBox({
8793
title: "Enter the ID:",
88-
value: Object.hasOwn(generators, generator)
89-
? generators[generator as keyof typeof generators]()
90-
: "", // Fallback to an empty string if the generator does not exist
91-
prompt:
92-
"Tip: It's best practice to use random names for your messages. Read this [guide](https://inlang.com/documentation/concept/message#idhuman-readable) for more information.",
94+
value: generatedValue,
95+
// Show the random-names tip only when a random generator is active
96+
prompt: showRandomNamesTip
97+
? "Tip: It's best practice to use random names for your messages. Read this [guide](https://inlang.com/documentation/concept/message#idhuman-readable) for more information."
98+
: undefined,
9399
})
94100

95101
if (bundleId === undefined) {

0 commit comments

Comments
 (0)