</div>
<div class="modal-footer">
<button type="button" class="btn btn-success"
- (click)="close(true)" i18n>Confirm</button>
+ (click)="close(true)" i18n>{{_confirmTrue}}</button>
<button type="button" class="btn btn-warning"
- (click)="close(false)" i18n>Cancel</button>
+ (click)="close(false)" i18n>{{_confirmFalse}}</button>
</div>
</ng-template>
+
+<eg-string #defaultDialogConfirmTrue i18n-text text="Confirm"></eg-string>
+<eg-string #defaultDialogConfirmFalse i18n-text text="Cancel"></eg-string>
\ No newline at end of file
-import {Component, Input, ViewChild, TemplateRef} from '@angular/core';
+import {Component, Input, ViewChild, TemplateRef, AfterViewInit} from '@angular/core';
import {DialogComponent} from '@eg/share/dialog/dialog.component';
+import {StringComponent} from '@eg/share/string/string.component';
@Component({
selector: 'eg-confirm-dialog',
/**
* Confirmation dialog that asks a yes/no question.
*/
-export class ConfirmDialogComponent extends DialogComponent {
+export class ConfirmDialogComponent extends DialogComponent implements AfterViewInit {
// What question are we asking?
@Input() public dialogBody: string;
+ @Input() public dialogConfirmTrue: string;
+ @Input() public dialogConfirmFalse: string;
@Input() public dialogBodyTemplate: TemplateRef<any>;
-}
+ _confirmTrue = '';
+ _confirmFalse = '';
+ @ViewChild('defaultDialogConfirmTrue', {static: false}) defaultDialogConfirmTrue: StringComponent;
+ @ViewChild('defaultDialogConfirmFalse', {static: false}) defaultDialogConfirmFalse: StringComponent;
+
+ // Get confirm/cancel strings from the component HTML
+ ngAfterViewInit() {
+ if ( this.dialogConfirmTrue && this.dialogConfirmTrue.length ) {
+ this._confirmTrue = this.dialogConfirmTrue;
+ }
+ else {
+ this.defaultDialogConfirmTrue.current().then(str => this._confirmTrue = str);
+ }
+
+ if ( this.dialogConfirmFalse && this.dialogConfirmFalse.length ) {
+ this._confirmFalse = this.dialogConfirmFalse;
+ }
+ else {
+ this.defaultDialogConfirmFalse.current().then(str => this._confirmFalse = str);
+ }
+
+
+ }
+ }
\ No newline at end of file
<div [ngbNavOutlet]="triggerNav" class="mt-2"></div>
<eg-confirm-dialog #confirmDialog
- i18n-dialogTitle i18n-dialogBody
+ i18n-dialogTitle i18n-dialogBody i18n-dialogConfirmTrue i18n-dialogConfirmFalse
dialogTitle="Alert"
- dialogBody="Clone event definition environment as well?">
+ dialogBody="Clone event definition environment as well?"
+ dialogConfirmTrue = "Yes"
+ dialogConfirmFalse = "No">
</eg-confirm-dialog>
<eg-string #createSuccessString i18n-text text="New entry Added"></eg-string>