Skip to content

Commit

Permalink
Put back llm_pgettext
Browse files Browse the repository at this point in the history
  • Loading branch information
GreenAsJade committed Sep 11, 2024
1 parent 8a6cb06 commit 9808393
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/lib/translate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,20 @@ export function pgettext(context: string, msgid: string) {
return debug_wrap(msgid);
}

/**
* Like pgettext(), but these strings will be automatically translated instead of passed along to our volunteers.
*
* The context is fed into the LLM system as general instructions and context.
* The msgid is the message that needs to be translated.
*/
export function llm_pgettext(context: string, msgid: string) {
const key = context + "" + msgid;
if (key in catalog) {
return catalog[key][0];
}
return debug_wrap(msgid);
}

/**
* Like pgettext() but for plural forms.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/views/HelpFlows/GameLogHelp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export function GameLogHelp(): JSX.Element {
>
<HelpItem target="autoscore-game-log-entry" position={"bottom-center"}>
<div>
{_(
{llm_pgettext(
"",
"These come from the user's browser during autoscoring. Two of these from each user, at the beginning of the scoring phase, and if the users presses 'auto-score'",
)}
</div>
Expand Down

0 comments on commit 9808393

Please sign in to comment.