Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 25 additions & 7 deletions packages/studio-web/src/app/upload/upload.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ export class UploadComponent implements OnDestroy, OnInit {
contactLink = environment.packageJson.contact;
progressMode: ProgressBarMode = "indeterminate";
progressValue = 0;
maxTxtSizeKB = 250; // Max 250 KB plain text file size
maxRasSizeKB = 250; // Max 250 KB .readalong XML text size
// Max plain text file size: 40KB is OK but takes around 15-20s on Heroku
maxTxtSizeKB = 40;
// Max .readalong XML text size: text * 5 is a rough heuristic; the XML is much bloated from the text.
maxRasSizeKB = 200;
@ViewChild("textInputElement") textInputElement: ElementRef;
@Output() stepChange = new EventEmitter<any[]>();

Expand Down Expand Up @@ -332,10 +334,25 @@ Please check it to make sure all words are spelled out completely, e.g. write "4
}
if (this.studioService.inputMethod.text === "edit") {
if (this.studioService.$textInput.value) {
let inputText = new Blob([this.studioService.$textInput.value], {
type: "text/plain",
});
this.studioService.textControl$.setValue(inputText);
const inputLength = this.studioService.$textInput.value.length;
if (inputLength > this.maxTxtSizeKB * 1024) {
this.toastr.error(
$localize`Text too large. Max size: ` +
this.maxTxtSizeKB +
$localize` KB.` +
$localize` Current size: ` +
Math.ceil(inputLength / 1024) +
$localize` KB.`,
$localize`Sorry!`,
{ timeOut: 15000 },
);
return;
} else {
let inputText = new Blob([this.studioService.$textInput.value], {
type: "text/plain",
});
this.studioService.textControl$.setValue(inputText);
}
} else {
this.toastr.error(
$localize`Please enter text to align.`,
Expand Down Expand Up @@ -525,8 +542,9 @@ Please check it to make sure all words are spelled out completely, e.g. write "4
: this.maxTxtSizeKB;
if (file.size > maxSizeKB * 1024) {
this.toastr.error(
$localize`File too large. Max size: ` + maxSizeKB + $localize` KB`,
$localize`File too large. Max size: ` + maxSizeKB + $localize` KB.`,
$localize`Sorry!`,
{ timeOut: 15000 },
);
this.textInputElement.nativeElement.value = "";
} else {
Expand Down
4 changes: 3 additions & 1 deletion packages/studio-web/src/i18n/messages.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
"1983793909601149790": "Por favor inténtelo de nuevo o seleccione un fichero pre-grabado.",
"3896053555277429649": "Por favor seleccione un idioma o la opción predeterminada",
"8052409322099101104": "Ningún idioma seleccionado",
"2970892766726423212": "El texto es demasiado grande. Tamaño máximo: ",
"1227277325872790936": " KB.",
"4346774921429520933": " Tamaño actual: ",
"3533349926767927338": "Por favor entre el texto que quiere alinear.",
"7881212750036563398": "Sin texto",
"3578398528078428417": "Por favor seleccione un fichero de texto.",
Expand All @@ -170,7 +173,6 @@
"1326685349515945581": " procesado pero no cargado. Su audio se mantendrá en su computadora.",
"6899344040225872362": "¡Genial!",
"7895338145504956239": "Fichero demasiado grande. Tamaño máximo: ",
"5997429059663319535": " KB",
"2722548994886578004": " procesado. El texto se cargará mediante una conexión encriptada cuando pase al próximo paso."
}
}
4 changes: 3 additions & 1 deletion packages/studio-web/src/i18n/messages.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
"1983793909601149790": "Prière de réessayer ou de choisir un fichier pré-enregistré.",
"3896053555277429649": "Prière de choisir une langue ou l'option par défaut",
"8052409322099101104": "Pas de langue choisie",
"2970892766726423212": "Texte trop long. Limite: ",
"1227277325872790936": " Ko.",
"4346774921429520933": " Taille actuelle: ",
"3533349926767927338": "Prière de saisir le texte à aligner.",
"7881212750036563398": "Pas de texte",
"3578398528078428417": "Prière de choisir un fichier texte.",
Expand All @@ -170,7 +173,6 @@
"1326685349515945581": " lu, mais pas téléversé. Votre audio restera sur votre ordinateur.",
"6899344040225872362": "Bravo!",
"7895338145504956239": "Fichier trop lourd. Poids maximal: ",
"5997429059663319535": " Ko",
"2722548994886578004": " lu. Il sera téléversé à l'aide d'une connexion chiffrée quand vous passerez à la prochaine étape."
}
}
4 changes: 3 additions & 1 deletion packages/studio-web/src/i18n/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
"1983793909601149790": "Please try again, or select a pre-recorded file.",
"3896053555277429649": "Please select a language or choose the default option",
"8052409322099101104": "No language selected",
"2970892766726423212": "Text too large. Max size: ",
"1227277325872790936": " KB.",
"4346774921429520933": " Current size: ",
"3533349926767927338": "Please enter text to align.",
"7881212750036563398": "No text",
"3578398528078428417": "Please select a text file.",
Expand All @@ -170,7 +173,6 @@
"1326685349515945581": " processed, but not uploaded. Your audio will stay on your computer.",
"6899344040225872362": "Great!",
"7895338145504956239": "File too large. Max size: ",
"5997429059663319535": " KB",
"2722548994886578004": " processed. It will be uploaded through an encrypted connection when you go to the next step."
}
}
Loading