translator: Update description.txt

This commit is contained in:
Aleksander 2026-08-02 20:46:20 +02:00 committed by galister
parent 3940e8b4f2
commit dcb01fdb6a
2 changed files with 16 additions and 8 deletions

View File

@ -20,4 +20,6 @@ Glossary:
End of glossary.
Style: These are UI elements in a software, so keep the translations cocise and with an appropriate tone. Don't use polite/formal language. Make sure it sounds natural.
You will be given the input in the code blocks which needs to be translated to {TARGET_LANG} language. Write only the result in codeblocks, do not explain. Keep any newlines and other important formatting-required identifiers as-is, in the same state.

View File

@ -141,11 +141,14 @@ function parse_csv(text: string): CsvEntry[] {
}
}
if (current) lines.push(current);
return lines.filter((l) => l.trim()).map(parse_csv_line).map(([key, english, context]) => ({
key,
english,
context,
}));
return lines
.filter((l) => l.trim())
.map(parse_csv_line)
.map(([key, english, context]) => ({
key,
english,
context,
}));
}
function csv_to_json(entries: CsvEntry[]): any {
@ -212,14 +215,13 @@ function gen_prompt(
num += 1;
}
description += "\nEnd of examples.\n\n";
description += "Context: " + context + "\n\n";
description +=
"Translate key `" +
key +
"` from English to " +
template.full_name +
":\n\n";
description += "Context: " + context + "\n\n";
description += "Style: These are UI elements in a software, so keep the translations cocise and with an appropriate tone. Don't use polite/formal language. Make sure it sounds natural.\n\n";
description += "```\n";
description += english_translation + "\n";
description += "```\n";
@ -302,7 +304,11 @@ async function run() {
console.log("Translating", key, "...");
const resolved_context = resolve_variables(context, llm_translated_json, csv_entries);
const resolved_context = resolve_variables(
context,
llm_translated_json,
csv_entries,
);
const prompt = gen_prompt(
description_txt,