feat: i18n for choice prompt via promptKey, with fallback
This commit is contained in:
@@ -26,6 +26,7 @@ export interface Choice {
|
||||
text: string
|
||||
textKey?: string
|
||||
prompt?: string
|
||||
promptKey?: string
|
||||
targetScene: string
|
||||
conditions?: Condition[]
|
||||
effects?: Effect[]
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"choice": {
|
||||
"handshake": "Shake hands with the stranger",
|
||||
"reject": "Refuse to shake, stay alert"
|
||||
},
|
||||
"prompt": {
|
||||
"handshake": "The stranger will remember your kindness"
|
||||
}
|
||||
},
|
||||
"right_door": {
|
||||
@@ -26,6 +29,9 @@
|
||||
"choice": {
|
||||
"journey": "Embark on a journey of trust (requires trust >= 80)",
|
||||
"leave": "Leave this place"
|
||||
},
|
||||
"prompt": {
|
||||
"journey": "Your bond will change everything"
|
||||
}
|
||||
},
|
||||
"investigation_site": {
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"choice": {
|
||||
"handshake": "見知らぬ人と握手する",
|
||||
"reject": "握手を断り、警戒を続ける"
|
||||
},
|
||||
"prompt": {
|
||||
"handshake": "見知らぬ人はあなたの優しさを覚えている"
|
||||
}
|
||||
},
|
||||
"right_door": {
|
||||
@@ -26,6 +29,9 @@
|
||||
"choice": {
|
||||
"journey": "信頼の旅に出る(trust >= 80 が必要)",
|
||||
"leave": "ここを去る"
|
||||
},
|
||||
"prompt": {
|
||||
"journey": "あなたの絆が全てを変える"
|
||||
}
|
||||
},
|
||||
"investigation_site": {
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
"choice": {
|
||||
"handshake": "与陌生人握手",
|
||||
"reject": "拒绝握手,保持警惕"
|
||||
},
|
||||
"prompt": {
|
||||
"handshake": "陌生人会记住你的善意"
|
||||
}
|
||||
},
|
||||
"right_door": {
|
||||
@@ -26,6 +29,9 @@
|
||||
"choice": {
|
||||
"journey": "开启信任的旅程(需要 trust >= 80)",
|
||||
"leave": "离开这里"
|
||||
},
|
||||
"prompt": {
|
||||
"journey": "你们的羁绊将改变一切"
|
||||
}
|
||||
},
|
||||
"investigation_site": {
|
||||
|
||||
@@ -211,6 +211,7 @@
|
||||
"text": "与陌生人握手",
|
||||
"textKey": "left_door.choice.handshake",
|
||||
"prompt": "陌生人会记住你的善意",
|
||||
"promptKey": "left_door.prompt.handshake",
|
||||
"targetScene": "trust_ending",
|
||||
"effects": [
|
||||
{ "type": "add", "target": "trust", "value": 30 }
|
||||
@@ -322,6 +323,7 @@
|
||||
"text": "开启信任的旅程(需要 trust >= 80)",
|
||||
"textKey": "trust_ending.choice.journey",
|
||||
"prompt": "你们的羁绊将改变一切",
|
||||
"promptKey": "trust_ending.prompt.journey",
|
||||
"targetScene": "secret_ending",
|
||||
"conditions": [
|
||||
{ "variable": "trust", "op": ">=", "value": 80 }
|
||||
|
||||
@@ -77,7 +77,7 @@ function handleChoose(index: number) {
|
||||
if (!choiceEnabled.value) return
|
||||
const choice = props.choices[index]
|
||||
if (choice?.prompt) {
|
||||
emit('prompt', choice.prompt)
|
||||
emit('prompt', t(choice.promptKey || choice.prompt))
|
||||
}
|
||||
emit('choose', index)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user