Skip to content

Commit

Permalink
Optimize translation prompts (#126)
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesHan authored Sep 13, 2024
1 parent 3013cc9 commit 12520fe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/lobe-i18n/examples/locale/flat/locales/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"ok": "Ok",
"cancel": "Cancel"
},
"list": ["How are you", "I'm fine."],
"welcome": "Welcome!"
}
5 changes: 3 additions & 2 deletions packages/lobe-i18n/examples/locale/flat/locales/ja_JP.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"buttons": {
"ok": "OK",
"cancel": "キャンセル"
"cancel": "キャンセル",
"ok": "はい"
},
"list": ["お元気ですか", "私は元気です。"],
"welcome": "ようこそ!"
}
5 changes: 3 additions & 2 deletions packages/lobe-i18n/examples/locale/flat/locales/zh_CN.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"buttons": {
"ok": "Ok",
"cancel": "Cancel"
"cancel": "取消",
"ok": "好的"
},
"list": ["你好吗", "我很好。"],
"welcome": "欢迎!"
}
1 change: 1 addition & 0 deletions packages/lobe-i18n/src/prompts/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const promptJsonTranslate = (reference: string = DEFAULT_REFERENCE) => {
`Translate the i18n JSON file from {from} to {to} according to the BCP 47 standard`,
`Here are some reference to help with better translation. ---${reference}---`,
`Keep the keys the same as the original file and make sure the output remains a valid i18n JSON file.`,
`Do not include any additional text or explanations outside the JSON object.Start directly with a left brace and end with a right brace.`,
]
.filter(Boolean)
.join('\n'),
Expand Down

0 comments on commit 12520fe

Please sign in to comment.