+
{
+ return this.http
+ .post(
+ `/api/author/project/translate/suggest`,
+ {
+ srcLang: defaultLanguage,
+ targetLang: currentLanguage,
+ srcText: this.addDoNotTranslateTags(defaultLanguageText)
+ },
+ { responseType: 'text' }
+ )
+ .pipe(map(this.removeDoNotTranslateTags));
+ }
+
+ private addDoNotTranslateTags(textToTranslate: string): string {
+ return textToTranslate.replaceAll(
+ /<.*?>/g,
+ (match) => '' + match + ' '
+ );
+ }
+
+ private removeDoNotTranslateTags(translatedText: string): string {
+ return translatedText.replaceAll(/<.*?><\/span>/g, (match) =>
+ match.slice(21, -7)
+ );
+ }
}
diff --git a/src/messages.xlf b/src/messages.xlf
index cba0709afeb..97b3eae5c14 100644
--- a/src/messages.xlf
+++ b/src/messages.xlf
@@ -491,6 +491,10 @@
src/assets/wise5/authoringTool/choose-node-location/choose-move-node-location/choose-move-node-location.component.html
3,6
+
+ src/assets/wise5/authoringTool/components/translation-suggestions-dialog/translation-suggestions-dialog.component.html
+ 16,17
+
src/assets/wise5/authoringTool/create-branch/create-branch.component.html
50,54
@@ -10838,6 +10842,13 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.5,9
+
+ There was an error translating the text. Please contact WISE staff if the error persists.
+
+ src/assets/wise5/authoringTool/components/abstract-translatable-field/abstract-translatable-field.component.ts
+ 106
+
+
Selected
@@ -11018,7 +11029,22 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Choose image
src/assets/wise5/authoringTool/components/translatable-asset-chooser/translatable-asset-chooser.component.ts
- 19
+ 20
+
+
+
+ Translate with AI
+
+ src/assets/wise5/authoringTool/components/translatable-input/translatable-input.component.html
+ 22,27
+
+
+ src/assets/wise5/authoringTool/components/translatable-rich-text-editor/translatable-rich-text-editor.component.html
+ 18,22
+
+
+ src/assets/wise5/authoringTool/components/translatable-textarea/translatable-textarea.component.html
+ 23,28
@@ -11032,21 +11058,70 @@ Click "Cancel" to keep the invalid JSON open so you can fix it.Note: Editing is disabled. Please switch back to if you want to edit.
src/assets/wise5/authoringTool/components/translatable-rich-text-editor/translatable-rich-text-editor.component.html
- 27,28
+ 33,34
Copy content to
src/assets/wise5/authoringTool/components/translatable-rich-text-editor/translatable-rich-text-editor.component.html
- 37,38
+ 43,44
Are you sure you want to replace the content in with content in for this item?
src/assets/wise5/authoringTool/components/translatable-rich-text-editor/translatable-rich-text-editor.component.ts
- 50,52
+ 59,61
+
+
+
+ Replace Translation
+
+ src/assets/wise5/authoringTool/components/translation-suggestions-dialog/translation-suggestions-dialog.component.html
+ 1,4
+
+
+
+ text:
+
+ src/assets/wise5/authoringTool/components/translation-suggestions-dialog/translation-suggestions-dialog.component.html
+ 4,5
+
+
+
+ text (current translation):
+
+ src/assets/wise5/authoringTool/components/translation-suggestions-dialog/translation-suggestions-dialog.component.html
+ 6,7
+
+
+
+ text (AI suggested translation):
+
+ src/assets/wise5/authoringTool/components/translation-suggestions-dialog/translation-suggestions-dialog.component.html
+ 8,9
+
+
+
+ Do you want to replace the current translation with the AI suggested translation?
+
+ src/assets/wise5/authoringTool/components/translation-suggestions-dialog/translation-suggestions-dialog.component.html
+ 11,15
+
+
+
+ Replace
+
+ src/assets/wise5/authoringTool/components/translation-suggestions-dialog/translation-suggestions-dialog.component.html
+ 17,19
+
+
+
+ There was an error translating the text. Please talk to WISE staff.
+
+ src/assets/wise5/authoringTool/components/translation-suggestions-dialog/translation-suggestions-dialog.component.ts
+ 47
@@ -19588,7 +19663,7 @@ Category Name:
src/assets/wise5/components/graph/graph-authoring/graph-authoring.component.html
- 297,301
+ 297,302