Skip to content

Commit

Permalink
feat(Multiple Languages): Convert EditComponentPrompt input to Transl…
Browse files Browse the repository at this point in the history
…atableInput (#1585)

* Pass in ComponentContent to EditComponentPrompt instead of prompt. This
will let us convert the input to TranslatableInput.
* Convert EditComponentPrompt input into TranslatableInput
  • Loading branch information
hirokiterashima authored Jan 24, 2024
1 parent 0ad71fd commit 4202c0a
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<mat-form-field class="prompt" appearance="fill">
<mat-label i18n>Prompt</mat-label>
<textarea
matInput
[(ngModel)]="prompt"
(ngModelChange)="promptChangedEvent.next($event)"
placeholder="Enter Prompt Here"
i18n-placeholder
cdkTextareaAutosize
>
</textarea>
</mat-form-field>
<translatable-input [content]="componentContent" key="prompt" class="prompt" appearance="fill">
<mat-form-field>
<mat-label i18n>Prompt</mat-label>
<textarea
matInput
[(ngModel)]="componentContent.prompt"
(ngModelChange)="promptChangedEvent.next($event)"
placeholder="Enter Prompt Here"
i18n-placeholder
cdkTextareaAutosize
>
</textarea>
</mat-form-field>
</translatable-input>
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { ComponentContent } from '../../../assets/wise5/common/ComponentContent';

@Component({
selector: 'edit-component-prompt',
styles: ['.prompt {width: 100%; }'],
styles: ['.prompt {width: 100%; mat-form-field { width:100%} }'],
templateUrl: 'edit-component-prompt.component.html'
})
export class EditComponentPrompt {
@Input()
prompt: string;

@Output()
promptChangedEvent = new EventEmitter<string>();
@Input() componentContent: ComponentContent;
@Output() promptChangedEvent = new EventEmitter<string>();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<div fxLayout="row">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<span i18n>Oscillator Types</span>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div fxLayout="column" fxLayoutGap="16px">
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<div fxLayoutGap="16px">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div fxLayout="column" fxLayoutGap="16px">
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<mat-form-field>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<div class="checkbox-container">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<div fxLayout="row" fxLayoutAlign="start center">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<div fxLayout="row wrap">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
>announcement</mat-icon
>
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<edit-component-prompt
*ngIf="!componentContent.dynamicPrompt?.enabled"
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<edit-dynamic-prompt
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<div fxLayoutGap="20px">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<div fxLayoutGap="20px">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<p i18n>Choose the step and component to show the summary data for:</p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<edit-component-prompt
[prompt]="componentContent.prompt"
[componentContent]="componentContent"
(promptChangedEvent)="promptChanged($event)"
></edit-component-prompt>
<div fxLayout="row wrap">
Expand Down
4 changes: 2 additions & 2 deletions src/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
<source>Prompt</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/authoring-tool/edit-component-prompt/edit-component-prompt.component.html</context>
<context context-type="linenumber">2</context>
<context context-type="linenumber">3</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/authoring-tool/edit-dynamic-prompt-rules/edit-dynamic-prompt-rules.component.html</context>
Expand All @@ -986,7 +986,7 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
<source>Enter Prompt Here</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/authoring-tool/edit-component-prompt/edit-component-prompt.component.html</context>
<context context-type="linenumber">7</context>
<context context-type="linenumber">8</context>
</context-group>
</trans-unit>
<trans-unit id="7affaae0e14529c0192d5a4bfabd6fcb1ea27529" datatype="html">
Expand Down

0 comments on commit 4202c0a

Please sign in to comment.