File

translation-editor/lazy/add-translation-modal/add-translation-modal.component.ts

Implements

OnInit

Metadata

Index

Properties
Methods

Constructor

constructor(formBuilder: FormBuilder)
Parameters :
Name Type Optional
formBuilder FormBuilder No

Methods

cancel
cancel()
Returns : void
initForm
initForm()
Returns : any
ngOnInit
ngOnInit()
Returns : void
save
save()
Returns : void

Properties

alreadyDefinedKeys
Type : string[]
Default value : []
alreadyTakenMsg
Default value : gettext('The provided translation key has already been defined.')
availableLangs
Type : literal type[]
Default value : []
form
Type : ReturnType<>
result
Default value : new Promise<ReturnType<typeof this.initForm>['value']>((resolve, reject) => { this._resovle = resolve; this._reject = reject; })
Readonly title
Default value : gettext('Add translation')
<c8y-modal
  [title]="title"
  [headerClasses]="'dialog-header'"
  (onDismiss)="cancel()"
  (onClose)="save()"
  [disabled]="form.invalid"
  [labels]="{ cancel: 'Cancel', ok: 'Add' }"
>
<ng-container c8y-modal-title>
  <span [c8yIcon]="'language1'"></span>
</ng-container>
  <div [formGroup]="form" class="p-24">
    <c8y-form-group>
      <label
        for="label"
        translate
      >
        Translation key
      </label>
      <input
        class="form-control"
        name="key"
        id="key"
        type="text"
        formControlName="key"
        placeholder="{{'e.g. {{ example }}' | translate : { example: 'Home' } }}"
      />
      <c8y-messages>
        <c8y-message
          name="keyAlreadyTaken"
          [text]="alreadyTakenMsg | translate"
        ></c8y-message>
      </c8y-messages>
    </c8y-form-group>

    <c8y-form-group *ngFor="let language of availableLangs">
      <label
        [for]="language.lang"
      >
        {{ language.nativeLanguage }} ({{ language.lang }})
      </label>
      <input
        class="form-control"
        [name]="language.lang"
        [id]="language.lang"
        type="text"
        [formControlName]="language.lang"
      />
    </c8y-form-group>
  </div>
</c8y-modal>

results matching ""

    No results matching ""