Merge pull request #3965 from tdonohue/port_2827_to_7x

[Port dspace-7_x] use translation service to determine placeholder values of date picker
This commit is contained in:
Tim Donohue
2025-02-06 16:33:33 -06:00
committed by GitHub
5 changed files with 24 additions and 8 deletions

View File

@@ -14,7 +14,7 @@
[(ngModel)]="initialYear" [(ngModel)]="initialYear"
[value]="year" [value]="year"
[invalid]="showErrorMessages" [invalid]="showErrorMessages"
[placeholder]='yearPlaceholder' [placeholder]="'form.date-picker.placeholder.year' | translate"
(blur)="onBlur($event)" (blur)="onBlur($event)"
(change)="onChange($event)" (change)="onChange($event)"
(focus)="onFocus($event)" (focus)="onFocus($event)"
@@ -29,7 +29,7 @@
[size]="6" [size]="6"
[(ngModel)]="initialMonth" [(ngModel)]="initialMonth"
[value]="month" [value]="month"
[placeholder]="monthPlaceholder" [placeholder]="'form.date-picker.placeholder.month' | translate"
[disabled]="!year || model.disabled" [disabled]="!year || model.disabled"
(blur)="onBlur($event)" (blur)="onBlur($event)"
(change)="onChange($event)" (change)="onChange($event)"
@@ -45,7 +45,7 @@
[size]="2" [size]="2"
[(ngModel)]="initialDay" [(ngModel)]="initialDay"
[value]="day" [value]="day"
[placeholder]="dayPlaceholder" [placeholder]="'form.date-picker.placeholder.day' | translate"
[disabled]="!month || model.disabled" [disabled]="!month || model.disabled"
(blur)="onBlur($event)" (blur)="onBlur($event)"
(change)="onChange($event)" (change)="onChange($event)"

View File

@@ -14,6 +14,7 @@ import {
mockDynamicFormValidationService mockDynamicFormValidationService
} from '../../../../../testing/dynamic-form-mock-services'; } from '../../../../../testing/dynamic-form-mock-services';
import { By } from '@angular/platform-browser'; import { By } from '@angular/platform-browser';
import { TranslateModule } from '@ngx-translate/core';
export const DATE_TEST_GROUP = new UntypedFormGroup({ export const DATE_TEST_GROUP = new UntypedFormGroup({
@@ -51,7 +52,8 @@ describe('DsDatePickerComponent test suite', () => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
NgbModule NgbModule,
TranslateModule.forRoot(),
], ],
declarations: [ declarations: [
DsDatePickerComponent, DsDatePickerComponent,

View File

@@ -9,6 +9,7 @@ import {
} from '@ng-dynamic-forms/core'; } from '@ng-dynamic-forms/core';
import { DOCUMENT } from '@angular/common'; import { DOCUMENT } from '@angular/common';
import isEqual from 'lodash/isEqual'; import isEqual from 'lodash/isEqual';
import { TranslateService } from '@ngx-translate/core';
export type DatePickerFieldType = '_year' | '_month' | '_day'; export type DatePickerFieldType = '_year' | '_month' | '_day';
@@ -48,10 +49,6 @@ export class DsDatePickerComponent extends DynamicFormControlComponent implement
minDay = 1; minDay = 1;
maxDay = 31; maxDay = 31;
yearPlaceholder = 'year';
monthPlaceholder = 'month';
dayPlaceholder = 'day';
disabledMonth = true; disabledMonth = true;
disabledDay = true; disabledDay = true;
@@ -59,6 +56,7 @@ export class DsDatePickerComponent extends DynamicFormControlComponent implement
constructor(protected layoutService: DynamicFormLayoutService, constructor(protected layoutService: DynamicFormLayoutService,
protected validationService: DynamicFormValidationService, protected validationService: DynamicFormValidationService,
protected translateService: TranslateService,
private renderer: Renderer2, private renderer: Renderer2,
@Inject(DOCUMENT) private _document: Document @Inject(DOCUMENT) private _document: Document
) { ) {

View File

@@ -5553,4 +5553,14 @@
// "workspace-item.delete.notification.error.content": "The workspace item could not be deleted", // "workspace-item.delete.notification.error.content": "The workspace item could not be deleted",
"workspace-item.delete.notification.error.content": "Das Workspace-Item konnte nicht gelöscht werden.", "workspace-item.delete.notification.error.content": "Das Workspace-Item konnte nicht gelöscht werden.",
// "form.date-picker.placeholder.year": "Year",
"form.date-picker.placeholder.year": "Jahr",
// "form.date-picker.placeholder.month": "Month",
"form.date-picker.placeholder.month": "Monat",
// "form.date-picker.placeholder.day": "Day",
"form.date-picker.placeholder.day": "Tag",
} }

View File

@@ -1808,6 +1808,12 @@
"form.number-picker.increment": "Increment {{field}}", "form.number-picker.increment": "Increment {{field}}",
"form.date-picker.placeholder.year": "Year",
"form.date-picker.placeholder.month": "Month",
"form.date-picker.placeholder.day": "Day",
"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",