|
| 1 | +<ng-container *transloco="let t; read: 'draft_sources'"> |
| 2 | + <h1>{{ t("configure_draft_sources") }}</h1> |
| 3 | + |
| 4 | + <mat-card> |
| 5 | + <mat-card-header> |
| 6 | + <mat-card-title>{{ t("train_language_model") }}</mat-card-title> |
| 7 | + </mat-card-header> |
| 8 | + <mat-card-content class="training-data-card-content"> |
| 9 | + <h3 class="heading-left">{{ t("overview_reference") }} {{ parentheses(referenceLanguageDisplayName) }}</h3> |
| 10 | + |
| 11 | + <div class="description-left">{{ t("select_primary_reference") }}</div> |
| 12 | + <div class="inputs-left"> |
| 13 | + @for (source of trainingSources; track $index) { |
| 14 | + <app-project-select |
| 15 | + [isDisabled]="loading || !appOnline" |
| 16 | + [projects]="projects" |
| 17 | + [resources]="resources" |
| 18 | + [nonSelectableProjects]="nonSelectableProjects" |
| 19 | + [value]="source?.paratextId" |
| 20 | + [hiddenParatextIds]="getHiddenParatextIds(trainingSources, source?.paratextId)" |
| 21 | + (valueChange)="sourceSelected(trainingSources, $index, $event)" |
| 22 | + [placeholder]="projectPlaceholder(source)" |
| 23 | + ></app-project-select> |
| 24 | + } |
| 25 | + |
| 26 | + @if (allowAddingATrainingSource) { |
| 27 | + <div>{{ t("some_projects_use_back_translation") }}</div> |
| 28 | + <button |
| 29 | + mat-button |
| 30 | + (click)="trainingSources.push(undefined); $event.preventDefault()" |
| 31 | + class="add-another-project" |
| 32 | + > |
| 33 | + <mat-icon>add</mat-icon> {{ t("add_another_reference_project") }} |
| 34 | + </button> |
| 35 | + } |
| 36 | + </div> |
| 37 | + |
| 38 | + <span class="arrow mirror-rtl"><mat-icon>arrow_right_alt</mat-icon></span> |
| 39 | + <h3 class="heading-right">{{ t("overview_translated_project") }} {{ parentheses(targetLanguageDisplayName) }}</h3> |
| 40 | + <div class="description-right"> |
| 41 | + @for (portion of i18n.interpolateVariables("draft_sources.project_always_used"); track $index) { |
| 42 | + @if (portion.id === "currentProjectShortName") { |
| 43 | + <strong>{{ currentProjectShortName }}</strong> |
| 44 | + } |
| 45 | + <!-- prettier-ignore --> |
| 46 | + @else {{{ portion.text }}} |
| 47 | + } |
| 48 | + <!-- Select here any other projects to be used on the target side. All of these should be in the language of the target (<strong>{{ targetLanguageDisplayName }}</strong>). --> |
| 49 | + </div> |
| 50 | + <div class="inputs-right"> |
| 51 | + @for (source of trainingTargets; track $index) { |
| 52 | + <app-project-select |
| 53 | + [isDisabled]="true" |
| 54 | + [projects]="projects" |
| 55 | + [resources]="resources" |
| 56 | + [nonSelectableProjects]="nonSelectableProjects" |
| 57 | + [value]="source?.paratextId" |
| 58 | + [hiddenParatextIds]="getHiddenParatextIds(trainingTargets, source?.paratextId)" |
| 59 | + [placeholder]="projectPlaceholder(source)" |
| 60 | + ></app-project-select> |
| 61 | + } |
| 62 | + </div> |
| 63 | + <div class="training-files"> |
| 64 | + <mat-divider></mat-divider> |
| 65 | + <h3>{{ t("additional_training_data_optional") }}</h3> |
| 66 | + <div>{{ t("training_files_description", { sourceLanguageDisplayName, targetLanguageDisplayName }) }}</div> |
| 67 | + <app-training-data-multi-select |
| 68 | + [availableTrainingData]="availableTrainingFiles" |
| 69 | + (trainingDataSelect)="onTrainingDataSelect($event)" |
| 70 | + ></app-training-data-multi-select> |
| 71 | + </div> |
| 72 | + </mat-card-content> |
| 73 | + </mat-card> |
| 74 | + |
| 75 | + <mat-card> |
| 76 | + <mat-card-header> |
| 77 | + <mat-card-title> {{ t("generate_a_draft_from_the_language_model") }} </mat-card-title> |
| 78 | + </mat-card-header> |
| 79 | + <mat-card-content class="translation-data-card-content"> |
| 80 | + <h3 class="heading-left">{{ t("overview_source") }} {{ parentheses(sourceLanguageDisplayName) }}</h3> |
| 81 | + <div class="description-left">{{ t("select_project_to_translate") }}</div> |
| 82 | + <div class="inputs-left"> |
| 83 | + @for (source of draftingSources; track $index) { |
| 84 | + <app-project-select |
| 85 | + [isDisabled]="loading || !appOnline" |
| 86 | + [projects]="projects" |
| 87 | + [resources]="resources" |
| 88 | + [nonSelectableProjects]="nonSelectableProjects" |
| 89 | + [value]="source?.paratextId" |
| 90 | + [hiddenParatextIds]="getHiddenParatextIds(draftingSources, source?.paratextId)" |
| 91 | + (valueChange)="sourceSelected(draftingSources, $index, $event)" |
| 92 | + [placeholder]="projectPlaceholder(source)" |
| 93 | + ></app-project-select> |
| 94 | + } |
| 95 | + </div> |
| 96 | + </mat-card-content> |
| 97 | + </mat-card> |
| 98 | + |
| 99 | + <app-language-codes-confirmation |
| 100 | + class="confirm-language-codes" |
| 101 | + [sources]="draftSourcesAsArray" |
| 102 | + [clearCheckbox]="clearLanguageCodeConfirmationCheckbox" |
| 103 | + (messageIfUserTriesToContinue)="languageCodeConfirmationMessageIfUserTriesToContinue = $event" |
| 104 | + ></app-language-codes-confirmation> |
| 105 | + |
| 106 | + <div class="component-footer"> |
| 107 | + @if (!appOnline) { |
| 108 | + <mat-error id="offline-message"> |
| 109 | + {{ t("offline_message") }} |
| 110 | + </mat-error> |
| 111 | + } |
| 112 | + <div class="page-actions"> |
| 113 | + <button mat-button (click)="cancel()"><mat-icon>close</mat-icon>{{ t("cancel") }}</button> |
| 114 | + <button id="save_button" mat-flat-button color="primary" (click)="save()" [disabled]="!appOnline"> |
| 115 | + <mat-icon>check</mat-icon>{{ t("save_and_sync") }} |
| 116 | + </button> |
| 117 | + </div> |
| 118 | + </div> |
| 119 | + |
| 120 | + @if (getControlState("projectSettings") != null) { |
| 121 | + <mat-card class="saving"> |
| 122 | + <mat-card-header> |
| 123 | + <mat-card-title>{{ t("saving_draft_sources") }}</mat-card-title> |
| 124 | + </mat-card-header> |
| 125 | + <mat-card-content> |
| 126 | + <div class="saving-indicator"> |
| 127 | + @if (getControlState("projectSettings") === ElementState.Submitting) { |
| 128 | + <mat-spinner [diameter]="24" color="primary"></mat-spinner> {{ t("saving") }} |
| 129 | + } @else if (getControlState("projectSettings") === ElementState.Submitted) { |
| 130 | + <mat-icon class="success">checkmark</mat-icon> {{ t("all_changes_saved") }} |
| 131 | + } @else { |
| 132 | + <mat-icon class="failure">error</mat-icon> {{ t("failed_to_save_changes") }} |
| 133 | + } |
| 134 | + </div> |
| 135 | + @for (entry of syncStatus | keyvalue; track entry.key) { |
| 136 | + <div> |
| 137 | + @if (entry.value.knownToBeOnSF) { |
| 138 | + @if (entry.value.isSyncing) { |
| 139 | + <mat-spinner [diameter]="24"></mat-spinner> {{ entry.value.shortName }} - {{ t("state_syncing") }} |
| 140 | + } @else { |
| 141 | + @if (entry.value.lastSyncSuccessful) { |
| 142 | + <mat-icon class="success">check</mat-icon> {{ entry.value.shortName }} - |
| 143 | + {{ t("state_sync_successful") }} |
| 144 | + } @else { |
| 145 | + <mat-icon class="failure">error</mat-icon> {{ entry.value.shortName }} - |
| 146 | + {{ t("state_sync_failed") }} |
| 147 | + } |
| 148 | + } |
| 149 | + } @else { |
| 150 | + <mat-spinner [diameter]="24"></mat-spinner> {{ entry.value.shortName }} - {{ t("state_connecting") }} |
| 151 | + } |
| 152 | + </div> |
| 153 | + } |
| 154 | + </mat-card-content> |
| 155 | + @if (allProjectsSavedAndSynced || getControlState("projectSettings") === ElementState.Error) { |
| 156 | + <mat-card-actions align="end"> |
| 157 | + <button mat-button (click)="navigateToDrafting()"><mat-icon>close</mat-icon> {{ t("close") }}</button> |
| 158 | + </mat-card-actions> |
| 159 | + } |
| 160 | + </mat-card> |
| 161 | + } |
| 162 | +</ng-container> |
0 commit comments