+ This translation has been signed off by two translators. No action is + needed. +
++ {proposal.modifiedFromLLM ? ( + <> + This is a proposal from a translator who has modified the + LLM-generated translation. + > + ) : ( + <> + This is the {locale} version of the English text on the + right. It was generated by an LLM and reviewed by another translator + who has marked it as correct. + > + )}{' '} + Please compare it to the original and either approve it, reject it, or + edit it further. +
+ ) +} diff --git a/app/javascript/components/localization/originals/show/Proposed/index.tsx b/app/javascript/components/localization/originals/show/Proposed/index.tsx new file mode 100644 index 0000000000..385051cd3a --- /dev/null +++ b/app/javascript/components/localization/originals/show/Proposed/index.tsx @@ -0,0 +1,343 @@ +import React, { + createContext, + useCallback, + useContext, + useMemo, + useState, +} from 'react' +import { flagForLocale } from '@/utils/flag-for-locale' +import { nameForLocale } from '@/utils/name-for-locale' +import { sendRequest } from '@/utils/send-request' +import { redirectTo } from '@/utils' +import { ProposalDescription } from './ProposalDescription' +import { FeedbackBlock } from './FeedbackBlock' +import { OriginalsShowContext } from '..' + +export type LLMFeedback = { + result: 'approved' | 'rejected' + reason: string +} + +export type Proposal = { + uuid: string + value: string + proposerId: string | number + modifiedFromLLM?: boolean + llmFeedback?: LLMFeedback | null + reviewerId?: string | number | null +} + +type Translation = { + status: 'proposed' + locale: string + proposals: Proposal[] + uuid: string +} + +type ProposedProps = { + translation: Translation + currentUserId: string | number + onApproveProposal: (params: { locale: string; proposalIndex: number }) => void + onRejectProposal: (params: { locale: string; proposalIndex: number }) => void + onEditProposal: (params: { locale: string; proposalIndex: number }) => void +} + +type ProposalCardContextType = { + editMode: boolean + setEditMode: (editMode: boolean) => void +} + +const ProposalCardContext = createContext+ There have been multiple proposals for this translation. Please + review the proposals. If one is correct, please approve it (which + will reject the others). Or if none are correct, reject each of + them, then edit the original LLM output yourself. +
+ )} + ++ This is the locale version of the English text on the right. It was + generated by an LLM. Please compare it to the original and check it + for weirdnesses or inaccuracies then either edit it or approve it. +
+ + {editMode ? ( ++ These are the locales you have opted into help translate. You can + change your locales{' '} + + here + + . +
+ {original.translations.map((translation, index) => { + switch (translation.status) { + case 'proposed': { + return ( ++ This is the original English value. Your job is to make the locales as + close to this in + meaning and tone + as possible. Please do not change the meaning away from the original + English. +
+Context
+