-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Apply Element language to Jitsi Widget #23412
Conversation
bd1a41e
to
b54324c
Compare
Signed-off-by: Oliver Sand <oliver.sand@nordeck.net>
b54324c
to
d9431e0
Compare
src/i18n/strings/de_DE.json
Outdated
@@ -17,6 +17,9 @@ | |||
"Failed to start": "Start fehlgeschlagen", | |||
"%(brand)s Desktop (%(platformName)s)": "%(brand)s Desktop (%(platformName)s)", | |||
"%(appName)s (%(browserName)s, %(osName)s)": "%(appName)s (%(browserName)s, %(osName)s)", | |||
"Failed to load Jitsi widget": "Das Jitsi Widget konnte nicht geladen werden", | |||
"Jitsi Video Conference": "Videokonferenz", | |||
"Join Conference": "Videokonferenz beitreten", | |||
"Please install <chromeLink>Chrome</chromeLink>, <firefoxLink>Firefox</firefoxLink>, or <safariLink>Safari</safariLink> for the best experience.": "Bitte installiere <chromeLink>Chrome</chromeLink>, <firefoxLink>Firefox</firefoxLink> oder <safariLink>Safari</safariLink> für das beste Erlebnis.", |
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.
As far as I understand, these changes are actually not allowed manually. I would like to keep them during the review phase as it is otherwise hard to test. I can remove them before a merge and submit them via the translation portal.
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.
Yes, that is why https://github.com/vector-im/element-web/actions/runs/3183049256/jobs/5209163177 fails.
You should just run yarn run i18n
after modifying translatable strings. For tests you may modify them locally.
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.
generally this is looking good - will check the webpack bundle size this week.
src/vector/jitsi/index.html
Outdated
@@ -10,7 +10,6 @@ | |||
<div class="joinConferenceFloating"> | |||
<div class="joinConferencePrompt"> | |||
<span class="icon"><!-- managed by CSS --></span> | |||
<!-- TODO: i18n --> |
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 h2 still isn't translated though?
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.
It is:
I can't do it inline, but I'm applying it later as soon as a I know the current language.
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.
a comment to indicate that would be appreciated :)
@@ -27,6 +27,7 @@ import { | |||
import { ElementWidgetActions } from "matrix-react-sdk/src/stores/widgets/ElementWidgetActions"; | |||
import { logger } from "matrix-js-sdk/src/logger"; | |||
import { IConfigOptions } from "matrix-react-sdk/src/IConfigOptions"; | |||
import { _t, setLanguage } from "matrix-react-sdk/src/languageHandler"; |
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.
we'll have to double check that this doesn't cause the bundle to rapidly expand, as it was a major concern last time we tried to add translations to the widget.
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.
Good point, sadly I would say the bundle sizes explodes: From 400k to 6mb…
It pulls in the whole matrix-react-sdk
, which is huge.
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.
Related: #12839
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.
Tree Shaking would be great, but that is not an easy change. Not sure if can refactor the language handler to be better useable. Building a custom translation solution for this widget doesn't feel right. I guess we have to postpone this PR.
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.
If we can better isolate the language handling code, I think that would be good. From inspecting the bundle it appears to be pulling in the js-sdk and a bunch of its dependencies, which would explain the size (the obvious indicator was the EventType enum).
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 like this will all be because of the SettingsStore
call in the language functions
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.
It's not just SettingsStore
, ModuleRunner
also pulls everything in. If I remove both, the bundle size is back to the previous size.
The good thing is that we don't need to read/write the settings for the Jitsi widget. It would be good if the SettingsStore
was just a wrapper interface around an actual implementation, either as a NoopSettingsStore for the Jitsi Widget, or the full store for the rest? The actual implementation could be inserted on startup. What do you think?
For ModuleRunner
, I guess the problem comes from ProxiedModuleApi
, but I haven't discovered the exact problem yet.
@Fox32 what is the status of this pull request? If you solved all issues and you think this PR is ready to be reviewed, please request a re-review. |
I plan to pull out at least the changes that apply the language to Jitsi, I think the rest of the PR is unlikely to be accepted due to the bundle size issues? |
I pulled out passing the language into #24609 |
Signed-off-by: Oliver Sand <oliver.sand@nordeck.net>
Signed-off-by: Oliver Sand <oliver.sand@nordeck.net>
I update this PR to the latest state and resolved some of the comments above. In the meantime I did #24609 which moves passing the language to Jitsi out of this PR. This PR is now only about applying the translations to the widget itself (error messages and welcome page). As discussed above, including the translation system of Element increases the bundle size significantly. I'm probably not the right one to refactor the We also started to use the Therefore, if we don't plan to merge it as-is, I would suggest to just close the PR 😁. |
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.
I would also suggest to close this PR, since the increase in bundle size is a bit larger than I'm comfortable with, and the fact that Jitsi is planned for deprecation makes me hesitant to suggest investing much more time in this.
Closing - though it really is a shame that our languageHandler isn't more standalone and just given the parameters it needs rather than fetching them from SettingStore, should really be a class with a singleton or DI. @Fox32 thanks for splitting out the non-contentious part of the PR and getting it landed!! |
Thanks for the responses 😊 |
This PR is ready, but I will keep it as a Draft as it requires matrix-org/matrix-react-sdk#9346.
This PR translates the start screen of the Jitsi Widget to the current language. It also supplies the current Element language to Jitsi, so that the UI is in the same language as Element.
Previously the start screen of the Jitsi Widget was hard-coded to English only. Jitsi itself auto-detected the language from the browser, so that the Element language had no influence.
Could be best tested with Cypress, but that isn't available here, right?
Checklist
Type: enhancement
Here's what your changelog entry will look like:
✨ Features