-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(Multilingual Unit): Translate HTML component #1663
feat(Multilingual Unit): Translate HTML component #1663
Conversation
Use this component to allow translators to translate html components
… between tabs and when translation text was undefined
Is there a WISE-API branch that should be used for testing with this? |
Yes, it's WISE-Community/WISE-API#253 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The functionality mostly works. I noticed some cases where there are some errors.
In these examples Spanish is the additional language.
-
If you change the html in Spanish and quickly switch to the English tab, the Spanish html will not be saved
-
An error shows up in the console when you perform any of these actions
- Use the language switcher at the top of the Authoring Tool to switch to Spanish and then expand the Rich Text (HTML) component
- Expand the Rich Text (HTML) component and use the language switcher at the top of the Authoring Tool to switch to Spanish
- If the Spanish html is empty and you switch from English to Spanish in the Rich Text (HTML) tab
This error will show up in the console
core.mjs:10614 ERROR TypeError: Cannot read properties of undefined (reading 'editor')
at WiseAuthoringTinymceEditorComponent.ngOnChanges (wise-tinymce-editor.component.ts:124:28)
at WiseAuthoringTinymceEditorComponent.rememberChangeHistoryAndInvokeOnChangesHook (core.mjs:3032:14)
- The editor for Spanish will break and stop rendering if you make a change in the Spanish html and then switch to English while you see the "Saving..." message at the top right
This error will show up in the console
core.mjs:10614 ERROR TypeError: You provided 'undefined' where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.
at createInvalidObservableTypeError (throwUnobservableError.js:2:12)
at innerFrom (innerFrom.js:37:43)
at catchError.js:10:38
…n language tabs. By only fetching the translation file when the user opens the translation tab, this fix should cut down on the number of errors. The whole solution may be difficult to track down and fix
Good catches. See my comments inline.
I tried using a translationTextDirty flag on I wonder how likely and often our translators will encounter this problem? If we don't fix it, the worst thing that happens is that the author loses a few words. Maybe we can hold off on a fix for now?
This should be fixed.
I couldn't figure out the root cause of this issue that I couldn't consistently reproduce. But I attempted a partial fix of this problem- this error seems to occur when the translation file is being requested in |
I think I might have found the root cause of problem 3. It seems like when you switch languages, it makes a request for the translation file but in certain situations the request for this file fails. I'm guessing it might be failing because the request is killed because it may no longer be needed or something. WISE-Client/src/assets/wise5/services/translateProjectService.ts Lines 49 to 53 in 0b43da6
If you change the code to add a catchError(), it prevents the rich text editor from breaking.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Changes
Notes
Test prep
Test (in the AT)