Merge pull request #3750 from NoelDeMartin/MOBILE-4387

MOBILE-4387 ui: Translate ion-select buttons
main
Pau Ferrer Ocaña 2023-07-25 08:46:06 +02:00 committed by GitHub
commit 0e72644556
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
27 changed files with 50 additions and 35 deletions

View File

@ -43,7 +43,7 @@
</ion-label>
<p *ngIf="eventTypes.length == 1" slot="end">{{eventTypes[0].name | translate }}</p>
<ion-select *ngIf="eventTypes.length > 1" formControlName="eventtype" interface="action-sheet"
[interfaceOptions]="{header: 'addon.calendar.eventkind' | translate}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: 'addon.calendar.eventkind' | translate}">
<ion-select-option *ngFor="let type of eventTypes" [value]="type.value">
{{ type.name | translate }}
</ion-select-option>
@ -56,7 +56,7 @@
<p class="item-heading" [core-mark-required]="true">{{ 'core.category' | translate }}</p>
</ion-label>
<ion-select formControlName="categoryid" interface="action-sheet" [placeholder]="'core.noselection' | translate"
[interfaceOptions]="{header: 'core.category' | translate}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: 'core.category' | translate}">
<ion-select-option *ngFor="let category of categories" [value]="category.id">
{{ category.name }}
</ion-select-option>
@ -69,7 +69,7 @@
<p class="item-heading" [core-mark-required]="true">{{ 'core.course' | translate }}</p>
</ion-label>
<ion-select formControlName="courseid" interface="action-sheet" [placeholder]="'core.noselection' | translate"
[interfaceOptions]="{header: 'core.course' | translate}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: 'core.course' | translate}">
<ion-select-option *ngFor="let course of courses" [value]="course.id">{{ course.fullname }}</ion-select-option>
</ion-select>
</ion-item>
@ -82,7 +82,8 @@
<p class="item-heading" [core-mark-required]="true">{{ 'core.course' | translate }}</p>
</ion-label>
<ion-select formControlName="groupcourseid" interface="action-sheet" [placeholder]="'core.noselection' | translate"
(ionChange)="groupCourseSelected()" [interfaceOptions]="{header: 'core.course' | translate}">
[cancelText]="'core.cancel' | translate" (ionChange)="groupCourseSelected()"
[interfaceOptions]="{header: 'core.course' | translate}">
<ion-select-option *ngFor="let course of courses" [value]="course.id">
{{ course.fullname }}
</ion-select-option>
@ -100,7 +101,7 @@
<p class="item-heading" [core-mark-required]="true">{{ 'core.group' | translate }}</p>
</ion-label>
<ion-select formControlName="groupid" interface="action-sheet" [placeholder]="'core.noselection' | translate"
[interfaceOptions]="{header: 'core.group' | translate}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: 'core.group' | translate}">
<ion-select-option *ngFor="let group of groups" [value]="group.id">{{ group.name }}</ion-select-option>
</ion-select>
</ion-item>

View File

@ -296,6 +296,7 @@
<p class="item-heading">{{ 'addon.mod_assign.grade' | translate }}</p>
</ion-label>
<ion-select [(ngModel)]="grade.grade" interface="action-sheet" [disabled]="grade.disabled"
[cancelText]="'core.cancel' | translate"
[interfaceOptions]="{header: 'addon.mod_assign.grade' | translate}">
<ion-select-option *ngFor="let grade of grade.scale" [value]="grade.value">
{{grade.label}}
@ -309,7 +310,8 @@
<p class="item-heading">{{ outcome.name }}</p>
</ion-label>
<ion-select *ngIf="canSaveGrades && outcome.itemNumber" [(ngModel)]="outcome.selectedId"
interface="action-sheet" [disabled]="gradeInfo!.disabled" [interfaceOptions]="{header: outcome.name }">
interface="action-sheet" [disabled]="gradeInfo!.disabled" [cancelText]="'core.cancel' | translate"
[interfaceOptions]="{header: outcome.name }">
<ion-select-option *ngFor="let grade of outcome.options" [value]="grade.value">
{{grade.label}}
</ion-select-option>

View File

@ -26,7 +26,7 @@
<ion-item class="ion-text-wrap">
<ion-label position="stacked">{{ 'core.sortby' | translate }}</ion-label>
<ion-select interface="action-sheet" name="sortBy" formControlName="sortBy" [placeholder]="'core.sortby' | translate"
[interfaceOptions]="{header: 'core.sortby' | translate}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: 'core.sortby' | translate}">
<optgroup *ngIf="fieldsArray.length" label="{{ 'addon.mod_data.fields' | translate }}">
<ion-select-option *ngFor="let field of fieldsArray" [value]="field.id">{{field.name}}</ion-select-option>
</optgroup>

View File

@ -1,7 +1,8 @@
<span *ngIf="inputMode && form" [formGroup]="form">
<span *ngIf="editMode" [core-mark-required]="field.required" class="core-mark-required"></span>
<ion-select [formControlName]="'f_'+field.id" multiple="true" [placeholder]="'addon.mod_data.menuchoose' | translate"
[interfaceOptions]="{header: field.name}" interface="alert">
[cancelText]="'core.cancel' | translate" [okText]="'core.ok' | translate" [interfaceOptions]="{header: field.name}"
interface="alert">
<ion-select-option *ngFor="let option of options" [value]="option.value">{{option.key}}</ion-select-option>
</ion-select>
<core-input-errors *ngIf="error && editMode" [control]="form.controls['f_'+field.id]" [errorText]="error"></core-input-errors>

View File

@ -1,7 +1,7 @@
<span *ngIf="inputMode && form" [formGroup]="form">
<span *ngIf="editMode" [core-mark-required]="field.required" class="core-mark-required"></span>
<ion-select [formControlName]="'f_'+field.id" [placeholder]="'addon.mod_data.menuchoose' | translate"
[interfaceOptions]="{header: field.name}" interface="action-sheet">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: field.name}" interface="action-sheet">
<ion-select-option value="">{{ 'addon.mod_data.menuchoose' | translate }}</ion-select-option>
<ion-select-option *ngFor="let option of options" [value]="option">{{option}}</ion-select-option>
</ion-select>

View File

@ -1,7 +1,8 @@
<span *ngIf="inputMode && form" [formGroup]="form">
<span *ngIf="editMode" [core-mark-required]="field.required" class="core-mark-required"></span>
<ion-select [formControlName]="'f_'+field.id" multiple="true" [placeholder]="'addon.mod_data.menuchoose' | translate"
[interfaceOptions]="{header: field.name}" interface="alert">
[cancelText]="'core.cancel' | translate" [okText]="'core.ok' | translate" [interfaceOptions]="{header: field.name}"
interface="alert">
<ion-select-option *ngFor="let option of options" [value]="option.value">{{option.key}}</ion-select-option>
</ion-select>
<core-input-errors *ngIf="error && editMode" [control]="form.controls['f_'+field.id]" [errorText]="error"></core-input-errors>

View File

@ -1,7 +1,8 @@
<span *ngIf="inputMode && form" [formGroup]="form">
<span *ngIf="editMode" [core-mark-required]="field.required" class="core-mark-required"></span>
<ion-select [formControlName]="'f_'+field.id" [placeholder]="'addon.mod_data.menuchoose' | translate"
[interfaceOptions]="{header: field.name}" interface="alert">
[cancelText]="'core.cancel' | translate" [okText]="'core.ok' | translate" [interfaceOptions]="{header: field.name}"
interface="alert">
<ion-select-option value="">{{ 'addon.mod_data.menuchoose' | translate }}</ion-select-option>
<ion-select-option *ngFor="let option of options" [value]="option">{{option}}</ion-select-option>
</ion-select>

View File

@ -62,7 +62,7 @@
<ion-select *ngIf="item.templateName == 'multichoice-d'" [required]="item.required"
name="{{item.typ}}_{{item.id}}" [(ngModel)]="item.value" interface="action-sheet"
[interfaceOptions]="{header: item.name}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: item.name}">
<ion-select-option *ngFor="let option of item.choices" [value]="option.value">
<core-format-text [component]="component" [componentId]="cmId" [text]="option.label"
contextLevel="module" [contextInstanceId]="cmId" [wsNotFiltered]="true" [courseId]="courseId">

View File

@ -49,7 +49,7 @@
<ion-label>{{ 'addon.mod_forum.group' | translate }}</ion-label>
<ion-select [(ngModel)]="newDiscussion.groupId" [disabled]="newDiscussion.postToAllGroups" interface="action-sheet"
name="groupid" [interfaceOptions]="{header: 'addon.mod_forum.group' | translate}"
(ionChange)="calculateGroupName()">
[cancelText]="'core.cancel' | translate" (ionChange)="calculateGroupName()">
<ion-select-option *ngFor="let group of groups" [value]="group.id">
<core-format-text [text]="group.name" contextLevel="course" [contextInstanceId]="courseId"
[wsNotFiltered]="true"></core-format-text>

View File

@ -32,7 +32,7 @@
{{ 'addon.mod_glossary.categories' | translate }}
</ion-label>
<ion-select [(ngModel)]="data.categories" multiple="true" interface="action-sheet"
[placeholder]="'addon.mod_glossary.categories' | translate" name="categories"
[placeholder]="'addon.mod_glossary.categories' | translate" name="categories" [cancelText]="'core.cancel' | translate"
[interfaceOptions]="{header: 'addon.mod_glossary.categories' | translate}">
<ion-select-option *ngFor="let category of categories" [value]="category.id">
{{ category.name }}

View File

@ -143,7 +143,8 @@
</core-format-text>
</p>
</ion-label>
<ion-select [id]="row.id" [formControlName]="row.name" interface="action-sheet">
<ion-select [id]="row.id" [formControlName]="row.name" [cancelText]="'core.cancel' | translate"
interface="action-sheet">
<ion-select-option *ngFor="let option of row.options" [value]="option.value">
{{option.label}}
</ion-select-option>

View File

@ -28,7 +28,8 @@
<!-- Retake selector if there is more than one retake. -->
<ion-item class="ion-text-wrap" *ngIf="student.attempts && student.attempts.length > 1">
<ion-label>{{ 'addon.mod_lesson.attemptheader' | translate }}</ion-label>
<ion-select [(ngModel)]="selectedRetake" (ionChange)="changeRetake(selectedRetake!)" interface="action-sheet"
<ion-select [(ngModel)]="selectedRetake" (ionChange)="changeRetake(selectedRetake!)"
[cancelText]="'core.cancel' | translate" interface="action-sheet"
[interfaceOptions]="{header: 'addon.mod_lesson.attemptheader' | translate}">
<ion-select-option *ngFor="let retake of student.attempts" [value]="retake.try">
{{retake.label}}

View File

@ -113,7 +113,8 @@
<ion-list>
<ion-item class="ion-text-wrap" *ngIf="organizations.length > 1">
<ion-label>{{ 'addon.mod_scorm.organizations' | translate }}</ion-label>
<ion-select [(ngModel)]="currentOrganization.identifier" (ionChange)="loadOrganization()" interface="action-sheet"
<ion-select [(ngModel)]="currentOrganization.identifier" (ionChange)="loadOrganization()"
[cancelText]="'core.cancel' | translate" interface="action-sheet"
[interfaceOptions]="{header: 'addon.mod_scorm.organizations' | translate}">
<ion-select-option *ngFor="let org of organizations" [value]="org.identifier">
{{ org.title }}

View File

@ -68,7 +68,8 @@
<ion-col class="ion-hide-md-up" size="5">
<ion-select class="ion-padding" [(ngModel)]="answers[question.name]" [required]="question.required"
[attr.aria-labelledby]="'addon-mod_survey-'+question.name" interface="action-sheet"
[name]="question.name" [interfaceOptions]="{header: question.text}">
[name]="question.name" [cancelText]="'core.cancel' | translate"
[interfaceOptions]="{header: question.text}">
<ion-select-option value="-1" selected disabled>{{ 'core.choose' | translate }}</ion-select-option>
<ion-select-option *ngFor="let option of question.optionsArray; let value=index;" [value]="value +1">
{{option}}
@ -90,7 +91,7 @@
<ion-col size="5">
<ion-select class="ion-padding" [(ngModel)]="answers[question.name]" [required]="question.required"
[attr.aria-labelledby]="'addon-mod_survey-'+question.name" interface="action-sheet" [name]="question.name"
[interfaceOptions]="{header: question.text}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: question.text}">
<ion-select-option [value]="question.required ? '-1' : '0'" selected [disabled]="question.required">
{{ 'core.choose' | translate }}
</ion-select-option>

View File

@ -14,7 +14,8 @@
</span>
</ion-label>
<ion-select [interfaceOptions]="{header: 'addon.mod_workshop_assessment_accumulative.dimensiongradefor' |
translate : {'$a': field.dimtitle }}" [(ngModel)]="selectedValues[n].grade" interface="action-sheet">
translate : {'$a': field.dimtitle }}" [(ngModel)]="selectedValues[n].grade" [cancelText]="'core.cancel' | translate"
interface="action-sheet">
<ion-select-option *ngFor="let grade of field.grades" [value]="grade.value">{{grade.label}}</ion-select-option>
</ion-select>
<core-input-errors *ngIf="fieldErrors['grade_' + n]" [errorText]="fieldErrors['grade_' + n]">

View File

@ -45,7 +45,7 @@
{{ 'addon.mod_workshop.assessmentweight' | translate }}
</span>
</ion-label>
<ion-select [(ngModel)]="weight" interface="action-sheet" name="weight"
<ion-select [(ngModel)]="weight" interface="action-sheet" name="weight" [cancelText]="'core.cancel' | translate"
[interfaceOptions]="{header: 'addon.mod_workshop.assessmentweight' | translate}">
<ion-select-option *ngFor="let w of weights" [value]="w">{{w}}</ion-select-option>
</ion-select>

View File

@ -66,7 +66,7 @@
{{ 'addon.mod_workshop.assessmentweight' | translate }}
</span>
</ion-label>
<ion-select formControlName="weight" required="true" interface="action-sheet"
<ion-select formControlName="weight" required="true" interface="action-sheet" [cancelText]="'core.cancel' | translate"
[interfaceOptions]="{header: 'addon.mod_workshop.assessmentweight' | translate}">
<ion-select-option *ngFor="let w of weights" [value]="w">{{ w }}</ion-select-option>
</ion-select>
@ -79,7 +79,7 @@
</ion-item>
<ion-item class="ion-text-wrap" *ngIf="access?.canoverridegrades">
<ion-label position="stacked">{{ 'addon.mod_workshop.gradinggradeover' | translate }}</ion-label>
<ion-select formControlName="grade" interface="action-sheet"
<ion-select formControlName="grade" interface="action-sheet" [cancelText]="'core.cancel' | translate"
[interfaceOptions]="{header: 'addon.mod_workshop.gradinggradeover' | translate}">
<ion-select-option *ngFor="let grade of evaluationGrades" [value]="grade.value">
{{grade.label}}

View File

@ -118,7 +118,7 @@
</ion-item>
<ion-item class="ion-text-wrap">
<ion-label position="stacked">{{ 'addon.mod_workshop.gradeover' | translate }}</ion-label>
<ion-select formControlName="grade" interface="action-sheet"
<ion-select formControlName="grade" interface="action-sheet" [cancelText]="'core.cancel' | translate"
[interfaceOptions]="{header: 'addon.mod_workshop.gradeover' | translate}">
<ion-select-option *ngFor="let grade of evaluationGrades" [value]="grade.value">
{{grade.label}}

View File

@ -50,7 +50,7 @@
</label>
<ion-select id="{{question!.select!.id}}" [name]="question!.select!.name" [(ngModel)]="question!.select!.selected"
interface="action-sheet" [disabled]="question!.select!.disabled" [slot]="question?.selectFirst ? 'start' : 'end'"
[interfaceOptions]="{header: 'addon.mod_quiz.unit' | translate}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: 'addon.mod_quiz.unit' | translate}">
<ion-select-option *ngFor="let option of question!.select!.options" [value]="option.value">
{{option.label}}
</ion-select-option>

View File

@ -17,6 +17,7 @@
</ion-label>
<ion-select id="{{row.id}}" [name]="row.name" [(ngModel)]="row.selected" interface="action-sheet"
[attr.aria-labelledby]="'addon-qtype-match-question-' + row.id" [disabled]="row.disabled"
[cancelText]="'core.cancel' | translate"
[ngClass]="{'addon-qtype-match-correct': row.isCorrect === 1,'addon-qtype-match-incorrect': row.isCorrect === 0}">
<ion-select-option *ngFor="let option of row.options" [value]="option.value">
{{option.label}}

View File

@ -24,7 +24,7 @@
</span>
</ion-label>
<ion-select [formControlName]="modelName" [placeholder]="'core.choosedots' | translate" interface="action-sheet"
[interfaceOptions]="{header: field.name}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: field.name}">
<ion-select-option value="">{{ 'core.choosedots' | translate }}</ion-select-option>
<ion-select-option *ngFor="let option of options" [value]="option">{{option}}</ion-select-option>
</ion-select>

View File

@ -12,7 +12,7 @@
<ng-container *ngIf="groupInfo.visibleGroups">{{'core.groupsvisible' | translate }}</ng-container>
</ion-label>
<ion-select [(ngModel)]="selected" (ionChange)="selectedChange.emit(selected)" interface="action-sheet"
[interfaceOptions]="{header: 'core.group' | translate}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: 'core.group' | translate}">
<ion-select-option *ngFor="let group of groupInfo.groups" [value]=" group.id">
<core-format-text [text]="group.name" contextLevel="course" [contextInstanceId]="courseId" [wsNotFiltered]="true">
</core-format-text>

View File

@ -1,7 +1,7 @@
<ion-item *ngIf="sites && sites.length">
<ion-label>{{ 'core.site' | translate }}</ion-label>
<ion-select [(ngModel)]="selectedSite" (ngModelChange)="siteSelected.emit(selectedSite)" interface="action-sheet"
[interfaceOptions]="{header: 'core.site' | translate}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: 'core.site' | translate}">
<ion-select-option *ngFor="let site of sites" [value]="site.id">{{ site.fullNameAndSiteName }}</ion-select-option>
</ion-select>
</ion-item>

View File

@ -54,7 +54,8 @@
<ion-label position="stacked">
<span core-mark-required="true">{{ 'core.wheredoyoulive' | translate }}</span>
</ion-label>
<ion-select name="country" formControlName="country" [placeholder]="'core.login.selectacountry' | translate">
<ion-select name="country" formControlName="country" [cancelText]="'core.cancel' | translate"
[okText]="'core.ok' | translate" [placeholder]="'core.login.selectacountry' | translate">
<ion-select-option value="">{{ 'core.login.selectacountry' | translate }}</ion-select-option>
<ion-select-option *ngFor="let country of countries" [value]="country.code">{{country.name}}</ion-select-option>
</ion-select>
@ -160,8 +161,8 @@
</ion-item>
<ion-item class="ion-text-wrap">
<ion-label position="stacked">{{ 'core.user.country' | translate }}</ion-label>
<ion-select name="country" formControlName="country" [placeholder]="'core.login.selectacountry' | translate">
<ion-select name="country" formControlName="country" [placeholder]="'core.login.selectacountry' | translate"
[cancelText]="'core.cancel' | translate" [okText]="'core.ok' | translate">
<ion-select-option value="">{{ 'core.login.selectacountry' | translate }}</ion-select-option>
<ion-select-option *ngFor="let country of countries" [value]="country.code">{{country.name}}</ion-select-option>
</ion-select>

View File

@ -1,7 +1,8 @@
<ion-item class="ion-text-wrap" *ngIf="item && (item!.canrate || item!.rating != null) && !disabled">
<ion-label>{{ 'core.rating.rating' | translate }}</ion-label>
<ion-select class="ion-text-start" [(ngModel)]="rating" (ngModelChange)="userRatingChanged()" interface="action-sheet"
[disabled]="!item!.canrate" [interfaceOptions]="{header: 'core.rating.rating' | translate}">
[cancelText]="'core.cancel' | translate" [disabled]="!item!.canrate"
[interfaceOptions]="{header: 'core.rating.rating' | translate}">
<ion-select-option *ngFor="let scaleItem of scale!.items" [value]="scaleItem.value">{{ scaleItem.name }}</ion-select-option>
</ion-select>
</ion-item>

View File

@ -16,7 +16,7 @@
<!-- Units. -->
<span class="accesshide" id="reminderUnits_label">{{ 'core.reminders.units' | translate }}</span>
<ion-select aria-labelledby="reminderUnits_label" name="customunits" [(ngModel)]="customUnits" interface="action-sheet"
slot="end" [interfaceOptions]="{header: 'core.reminders.units' | translate}">
slot="end" [cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: 'core.reminders.units' | translate}">
<ion-select-option *ngFor=" let option of customUnitsOptions" [value]="option.value">
{{ option.label | translate }}
</ion-select-option>

View File

@ -16,7 +16,7 @@
<p class="item-heading">{{ 'core.settings.language' | translate }}</p>
</ion-label>
<ion-select [(ngModel)]="selectedLanguage" (ionChange)="languageChanged($event)" interface="action-sheet"
[interfaceOptions]="{header: 'core.settings.language' | translate}">
[cancelText]="'core.cancel' | translate" [interfaceOptions]="{header: 'core.settings.language' | translate}">
<ion-select-option *ngFor="let entry of languages" [value]="entry.code">{{ entry.name }}</ion-select-option>
</ion-select>
</ion-item>
@ -41,7 +41,8 @@
<p *ngIf="colorSchemeDisabled" class="text-danger">{{ 'core.settings.forcedsetting' | translate }}</p>
</ion-label>
<ion-select [(ngModel)]="selectedScheme" (ionChange)="colorSchemeChanged($event)" interface="action-sheet"
[disabled]="colorSchemeDisabled" [interfaceOptions]="{header: 'core.settings.colorscheme' | translate}">
[cancelText]="'core.cancel' | translate" [disabled]="colorSchemeDisabled"
[interfaceOptions]="{header: 'core.settings.colorscheme' | translate}">
<ion-select-option *ngFor="let scheme of colorSchemes" [value]="scheme">
{{ 'core.settings.colorscheme-' + scheme | translate }}</ion-select-option>
</ion-select>