Skip to content

Multiple surveys support for translations download#4

Open
rama-medallia wants to merge 1 commit intomainfrom
APPSOL-7783-multiple-surveys-support-and-other-enhancements
Open

Multiple surveys support for translations download#4
rama-medallia wants to merge 1 commit intomainfrom
APPSOL-7783-multiple-surveys-support-and-other-enhancements

Conversation

@rama-medallia
Copy link
Collaborator

Currently, you can only provide one survey UUID or name:

mec translations download --survey-uuid f0473723-45f0-4397-b39e-d2bf3d955a20
mec translations download --survey-name "Customer Feedback"

With this enhancement, you can specify multiple surveys:

mec translations download --survey-uuid "f0473723-45f0-4397-b39e-d2bf3d955a20" --survey-uuid "f0473723-45f0-4397-b39e-d2bf3d955a21"
mec translations download --survey-name "Customer Feedback" --survey-name "Employee Feedback"

@rama-medallia rama-medallia requested a review from Copilot February 6, 2026 21:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for downloading translations for multiple surveys in a single CLI invocation.

Changes:

  • Update CLI parser to accept repeated --survey-uuid / --survey-name values.
  • Update translations download flow to handle multiple surveys (IDs in filenames, multiple flat views, combined “Where Used”).
  • Update surveys “Where Used” mapping to include survey name context and return a pre-built Map.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/ui/parser/parser.ts Accept arrays for survey UUID/name options and add multi-survey examples.
src/core/services/translations/types.ts Change download options to accept multiple surveys.
src/core/services/translations/translations-service.ts Download/export using multiple translation tag IDs; merge “Where Used”; update filenames and notes.
src/core/services/surveys/surveys-service.ts Update “Where Used” builder to include survey name and pre-build a Map.
src/commands/translations.ts Collect multiple surveys from CLI options and pass to download service.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +54 to +68
if (surveyUuids && surveyUuids.length > 0) {
for (const uuid of surveyUuids) {
const survey = await surveyService.getSurveyByUuid(uuid as string);
if (!survey) {
throw new ValidationError(`Survey not found for UUID: "${uuid}"`);
}
surveyItemList.push(survey);
}
survey = surveys[0];
}

if (!survey) {
if (surveyName) {
throw new ValidationError(`Survey not found for name: "${surveyName}"`);
} else {
throw new ValidationError(`Survey not found for UUID: "${surveyUuid}"`);
// Process survey names
if (surveyNames && surveyNames.length > 0) {
for (const surveyName of surveyNames) {
const surveys = await surveyService.getSurveyByName(surveyName as string);
if (surveys.length > 1) {
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Survey lookups are awaited sequentially inside loops, which adds avoidable latency when multiple surveys are provided. Consider fetching in parallel (e.g., build an array of promises and await Promise.all(...)) and then append results in order.

Copilot uses AI. Check for mistakes.
notes.push('Contains variable text');
}

// TODO: Add usage note - Remove due to API limitations and not able to idenfity usage for all kes/texts in all surveys.
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct typo: 'idenfity' → 'identify'.

Suggested change
// TODO: Add usage note - Remove due to API limitations and not able to idenfity usage for all kes/texts in all surveys.
// TODO: Add usage note - Remove due to API limitations and not able to identify usage for all kes/texts in all surveys.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be discussed, mostly will be removed later on.

notes.push('Contains variable text');
}

// TODO: Add usage note - Remove due to API limitations and not able to idenfity usage for all kes/texts in all surveys.
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct typo: 'kes' → 'keys'.

Suggested change
// TODO: Add usage note - Remove due to API limitations and not able to idenfity usage for all kes/texts in all surveys.
// TODO: Add usage note - Remove due to API limitations and not able to idenfity usage for all keys/texts in all surveys.

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be discussed, mostly will be removed later on.

Comment on lines +426 to +433
// TODO: Add usage note - Remove due to API limitations and not able to idenfity usage for all kes/texts in all surveys.
if (usedInMultiplePlaces) {
notes.push('Used in multiple surveys');
}

return '';
return notes.length > 0
? `${notes.join(' and ')} - please be mindful of the structure when performing the translation.`
: '';
Copy link

Copilot AI Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TODO comment is contradictory to the behavior (it says to remove the usage note due to limitations, but the code adds it). Also, joining notes with ' and ' can produce awkward output when multiple notes exist (e.g., 'Contains HTML/code and variable text and Used in multiple surveys ...'). Consider clarifying/removing the TODO and improving the note composition (e.g., join with commas and a final 'and', or split the usage note into a separate sentence).

Suggested change
// TODO: Add usage note - Remove due to API limitations and not able to idenfity usage for all kes/texts in all surveys.
if (usedInMultiplePlaces) {
notes.push('Used in multiple surveys');
}
return '';
return notes.length > 0
? `${notes.join(' and ')} - please be mindful of the structure when performing the translation.`
: '';
// Add usage note when we know the text is reused in multiple places.
// Due to API limitations we may not be able to determine usage for all keys/texts in all surveys.
if (usedInMultiplePlaces) {
notes.push('Used in multiple surveys');
}
if (notes.length === 0) {
return '';
}
let notesText: string;
if (notes.length === 1) {
notesText = notes[0];
} else if (notes.length === 2) {
notesText = `${notes[0]} and ${notes[1]}`;
} else {
const allButLast = notes.slice(0, -1).join(', ');
const last = notes[notes.length - 1];
notesText = `${allButLast} and ${last}`;
}
return `${notesText} - please be mindful of the structure when performing the translation.`;

Copilot uses AI. Check for mistakes.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be discussed, mostly will be removed later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants