Move increment/decrement to i18n. Update to use "name".

This commit is contained in:
Tim Donohue
2024-01-17 11:49:00 -06:00
parent 31bc05235e
commit 0aaf3131fa
4 changed files with 13 additions and 4 deletions

View File

@@ -6,7 +6,7 @@
[disabled]="disabled"
(click)="toggleUp()">
<span class="chevron"></span>
<span class="sr-only">Increment {{placeholder}}</span>
<span class="sr-only">{{'form.number-picker.increment' | translate: {field: name} }}</span>
</button>
<input
id="{{id}}"
@@ -33,6 +33,6 @@
[disabled]="disabled"
(click)="toggleDown()">
<span class="chevron bottom"></span>
<span class="sr-only">Decrement {{placeholder}}</span>
<span class="sr-only">{{'form.number-picker.decrement' | translate: {field: name} }}</span>
</button>
</div>

View File

@@ -7,6 +7,7 @@ import { By } from '@angular/platform-browser';
import { NumberPickerComponent } from './number-picker.component';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { createTestComponent } from '../../testing/utils.test';
import { TranslateModule } from '@ngx-translate/core';
describe('NumberPickerComponent test suite', () => {
@@ -23,7 +24,8 @@ describe('NumberPickerComponent test suite', () => {
imports: [
FormsModule,
ReactiveFormsModule,
NgbModule
NgbModule,
TranslateModule.forRoot()
],
declarations: [
NumberPickerComponent,

View File

@@ -1,5 +1,6 @@
import { ChangeDetectorRef, Component, EventEmitter, Input, OnInit, Output, SimpleChanges, } from '@angular/core';
import { ControlValueAccessor, UntypedFormBuilder, NG_VALUE_ACCESSOR } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core';
import { isEmpty } from '../../empty.util';
@Component({
@@ -31,7 +32,9 @@ export class NumberPickerComponent implements OnInit, ControlValueAccessor {
startValue: number;
constructor(private fb: UntypedFormBuilder, private cd: ChangeDetectorRef) {
constructor(private fb: UntypedFormBuilder,
private cd: ChangeDetectorRef,
private translate: TranslateService) {
}
ngOnInit() {

View File

@@ -1770,6 +1770,10 @@
"form.repeatable.sort.tip": "Drop the item in the new position",
"form.number-picker.decrement": "Decrement {{field}}",
"form.number-picker.increment": "Increment {{field}}",
"grant-deny-request-copy.deny": "Don't send copy",
"grant-deny-request-copy.email.back": "Back",