Skip to content

Commit

Permalink
Add approve all option
Browse files Browse the repository at this point in the history
  • Loading branch information
icodesign committed Aug 31, 2024
1 parent 544aec0 commit c2ffebc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/translate/src/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export function convertXliffsToEntities(
throw new Error(`Cannot merge file without target language.`);
}
for (const file of xliff.elements || []) {
const startKeys = [sourceLanguage, targetLanguage, file.attributes.id];
const startKeys = [file.attributes.id];
for (const element of file.elements || []) {
const entities = convertXliffElementToEntities(
element,
Expand Down
12 changes: 11 additions & 1 deletion packages/translate/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,8 @@ async function translateStrings(
var approved = 0;
var declined = 0;
var refineNeeded = 0;
for (const entity of translations) {
for (let index = 0; index < translations.length; index++) {
const entity = translations[index];
if (entity.needsReview) {
logger.info(
`Skip reviewing ${entity.key} because all target languages are skipped.`,
Expand Down Expand Up @@ -269,6 +270,11 @@ async function translateStrings(
value: LOCALITION_REVIEW_SUBSTATE_DECLINED,
description: 'The translation will be discarded',
},
{
name: 'Approve All',
value: 'approveAll',
description: 'Skip reviewing all translations for this string',
},
],
},
{
Expand Down Expand Up @@ -298,6 +304,10 @@ async function translateStrings(
entity.addNotes([auditSuggestion]);
remainings.push(entity);
refineNeeded += 1;
} else if (reviewResult === 'approveAll') {
reviewed.push(...translations.slice(index));
approved += translations.length - index;
break;
}
}

Expand Down

0 comments on commit c2ffebc

Please sign in to comment.