diff --git a/src/screens/deck-form/answer-form-view.tsx b/src/screens/deck-form/answer-form-view.tsx index c349adff..562d7c10 100644 --- a/src/screens/deck-form/answer-form-view.tsx +++ b/src/screens/deck-form/answer-form-view.tsx @@ -88,23 +88,22 @@ export const AnswerFormView = observer((props: Props) => { return ( - - Advanced + {t("card_advanced")} { { - showAlert( - `The type of answer you'll need to provide for this card. Choose "Yes No" if you want to select between "Remember" and "Don't remember". Select "Choice" if you want to select between answers.`, - ); + showAlert(t("answer_type_explanation")); }} > - Answer{" "} + {t("answer")}{" "} { options={[ { id: "remember", - label: "Yes No", + label: t("yes_no"), }, { id: "choice_single", - label: "Choice", + label: t("answer_type_choice"), }, ]} /> @@ -154,7 +152,7 @@ export const CardFormView = observer((props: Props) => { {" "} - Add answer + {t("add_answer")} diff --git a/src/screens/deck-form/store/deck-form-store.ts b/src/screens/deck-form/store/deck-form-store.ts index 8901c006..5d3700a1 100644 --- a/src/screens/deck-form/store/deck-form-store.ts +++ b/src/screens/deck-form/store/deck-form-store.ts @@ -85,12 +85,12 @@ export const createAnswerListField = ( if (value.length > 0) { if (value.every((item) => !item.isCorrect.value)) { - return "One answer should be selected as correct"; + return t('validation_answer_at_least_one_correct'); } } if (value.length === 0) { - return "At least one answer should be provided"; + return t('validation_at_least_one_answer_required'); } }); }; diff --git a/src/screens/folder-form/store/folder-form-store.ts b/src/screens/folder-form/store/folder-form-store.ts index e3fefda7..cb142b8f 100644 --- a/src/screens/folder-form/store/folder-form-store.ts +++ b/src/screens/folder-form/store/folder-form-store.ts @@ -19,6 +19,14 @@ const createFolderTitleField = (title: string) => { return new TextField(title, validators.required(t("validation_required"))); }; +const createDecksField = (decks: Array<{ id: number; name: string }>) => { + return new ListField<{ id: number; name: string }>(decks, (value) => { + if (value.length === 0) { + return t("validation_at_least_one_deck"); + } + }); +}; + type FolderForm = { title: TextField; description: TextField; @@ -53,7 +61,7 @@ export class FolderFormStore { this.folderForm = { title: createFolderTitleField(folder.name), description: new TextField(folder.description ?? ""), - decks: new ListField( + decks: createDecksField( folder.decks.map((deck) => ({ id: deck.id, name: deck.name })), ), }; @@ -61,7 +69,7 @@ export class FolderFormStore { this.folderForm = { title: createFolderTitleField(""), description: new TextField(""), - decks: new ListField<{ id: number; name: string }>([]), + decks: createDecksField([]), }; } } diff --git a/src/translations/t.ts b/src/translations/t.ts index d57a20cb..2670ed09 100644 --- a/src/translations/t.ts +++ b/src/translations/t.ts @@ -130,6 +130,21 @@ const en = { share_no_links_for_folder: "You haven't created any one-time links for this folder", go_back: "Go back", + validation_at_least_one_deck: "Please select at least 1 deck", + add_answer: "Add answer", + edit_answer: "Edit answer", + answer_text: "Answer text", + is_correct: "Is correct", + is_correct_explanation: `There can only be one correct answer`, + card_advanced: "Advanced", + answer: 'Answer', + yes_no: "Yes No", + answer_type_choice: "Choice", + answer_type_explanation: `The type of answer you'll need to provide for this card. Choose "Yes No" if you want to select between "Remember" and "Don't remember". Select "Choice" if you want to select between answers.`, + validation_answer_at_least_one_correct: + "One answer should be selected as correct", + validation_at_least_one_answer_required: + "At least one answer should be provided", delete_folder_confirm: "Do you want to delete the folder? Deleting folder won't remove decks inside the folder", }; @@ -137,6 +152,19 @@ const en = { type Translation = typeof en; const ru: Translation = { + validation_at_least_one_deck: "Пожалуйста выберите хотя бы 1 колоду", + validation_answer_at_least_one_correct: "Выберите хотя бы 1 правильный ответ", + add_answer: "Добавить ответ", + answer_text: "Текст ответа", + answer_type_choice: "Варианты", + answer: 'Ответ', + answer_type_explanation: `Тип ответа, который вам нужно будет предоставить для этой карточки. Выберите "Да Нет", если хотите выбрать между "Помню" и "Не помню". Выберите "Варианты", если хотите выбирать между вариантами ответа.`, + card_advanced: "Дополнительно", + edit_answer: "Редактировать ответ", + is_correct: "Правильный", + validation_at_least_one_answer_required: "Укажите хотя бы 1 ответ", + yes_no: "Да Нет", + is_correct_explanation: `Может быть только один правильный ответ`, share_folder_settings: "Настройки шеринга папки", share_no_links_for_folder: "Вы еще не создали одноразовых ссылок для этой папки", @@ -269,6 +297,19 @@ const ru: Translation = { }; const es: Translation = { + validation_at_least_one_deck: "Por favor, selecciona al menos 1 mazo", + yes_no: "Sí No", + validation_at_least_one_answer_required: "Se debe proporcionar al menos una respuesta", + is_correct: "Es correcto", + validation_answer_at_least_one_correct: "Se debe seleccionar al menos una respuesta correcta", + edit_answer: "Editar respuesta", + card_advanced: "Avanzado", + answer_type_explanation: `El tipo de respuesta que deberás proporcionar para esta tarjeta. Elige "Sí No" si quieres seleccionar entre "Recuerdo" y "No recuerdo". Selecciona "Elección" si quieres seleccionar entre respuestas.`, + answer: 'Respuesta', + answer_type_choice: "Elección", + answer_text: "Texto de la respuesta", + add_answer: "Añadir respuesta", + is_correct_explanation: `Solo puede haber una respuesta correcta`, card_preview: "Vista previa", share_no_links_for_folder: "No has creado ningún enlace de un solo uso para esta carpeta", @@ -405,6 +446,19 @@ const es: Translation = { }; const ptBr: Translation = { + validation_answer_at_least_one_correct: "Selecione pelo menos uma resposta correta", + is_correct_explanation: `Só pode haver uma resposta correta`, + add_answer: "Adicionar resposta", + answer_text: "Texto da resposta", + answer_type_choice: "Escolha", + answer: 'Resposta', + answer_type_explanation: `O tipo de resposta que você precisará fornecer para este cartão. Escolha "Sim Não" se você quiser selecionar entre "Lembrar" e "Não lembrar". Selecione "Escolha" se você quiser selecionar entre respostas.`, + card_advanced: "Avançado", + edit_answer: "Editar resposta", + is_correct: "É correto", + validation_at_least_one_answer_required: "Pelo menos uma resposta deve ser fornecida", + yes_no: "Sim Não", + validation_at_least_one_deck: "Por favor, selecione pelo menos 1 baralho", share_folder_settings: "Compartilhar pasta", share_no_links_for_folder: "Você ainda não criou nenhum link para esta pasta", card_preview: "Visualização",