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

View File

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

View File

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

View File

@@ -1770,6 +1770,10 @@
"form.repeatable.sort.tip": "Drop the item in the new position", "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.deny": "Don't send copy",
"grant-deny-request-copy.email.back": "Back", "grant-deny-request-copy.email.back": "Back",