-
Notifications
You must be signed in to change notification settings - Fork 194
bugfix(web-runtime): [OCISDEV-267] fix progress bar not being translated when user changes language #13108
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
bugfix(web-runtime): [OCISDEV-267] fix progress bar not being translated when user changes language #13108
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Bugfix: Show translation of progress bar without refresh | ||
|
|
||
| We've added a fix to ensure that the progress bar translations are displayed correctly without needing to refresh the page. | ||
|
|
||
| https://kiteworks.atlassian.net/browse/OCISDEV-267 | ||
| https://github.com/owncloud/web/pull/13108 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -203,28 +203,44 @@ export default defineComponent({ | |
|
|
||
| const progressBarExtensionId = 'com.github.owncloud.web.runtime.default-progress-bar' | ||
| const progressBarExtensionPointId = 'app.runtime.global-progress-bar' | ||
| const defaultProgressBarExtension: CustomComponentExtension = { | ||
| id: progressBarExtensionId, | ||
| type: 'customComponent', | ||
| extensionPointIds: [progressBarExtensionPointId], | ||
| content: LoadingIndicator, | ||
| userPreference: { | ||
| optionLabel: $gettext('Default progress bar') | ||
|
|
||
| function registerProgressBarExtension() { | ||
| const defaultProgressBarExtension: CustomComponentExtension = { | ||
| id: progressBarExtensionId, | ||
| type: 'customComponent', | ||
| extensionPointIds: [progressBarExtensionPointId], | ||
| content: LoadingIndicator, | ||
| userPreference: { | ||
| optionLabel: $gettext('Default progress bar') | ||
| } | ||
| } | ||
| } | ||
| extensionRegistry.registerExtensions(toRef([defaultProgressBarExtension] satisfies Extension[])) | ||
| const progressBarExtensionPoint: ExtensionPoint<CustomComponentExtension> = { | ||
| id: progressBarExtensionPointId, | ||
| extensionType: 'customComponent', | ||
| multiple: false, | ||
| defaultExtensionId: defaultProgressBarExtension.id, | ||
| userPreference: { | ||
| label: $gettext('Global progress bar'), | ||
| description: $gettext('Customize your progress bar') | ||
| extensionRegistry.registerExtensions( | ||
| toRef([defaultProgressBarExtension] satisfies Extension[]) | ||
| ) | ||
| const progressBarExtensionPoint: ExtensionPoint<CustomComponentExtension> = { | ||
| id: progressBarExtensionPointId, | ||
| extensionType: 'customComponent', | ||
| multiple: false, | ||
| defaultExtensionId: defaultProgressBarExtension.id, | ||
| userPreference: { | ||
| label: $gettext('Global progress bar'), | ||
| description: $gettext('Customize your progress bar') | ||
| } | ||
| } | ||
| extensionRegistry.registerExtensionPoints(toRef([progressBarExtensionPoint])) | ||
| return progressBarExtensionPoint | ||
| } | ||
| const extensionPoints = computed<ExtensionPoint<Extension>[]>(() => [progressBarExtensionPoint]) | ||
| extensionRegistry.registerExtensionPoints(extensionPoints) | ||
|
|
||
| const progressBarExtensionPoint = ref(registerProgressBarExtension()) | ||
|
|
||
| watch( | ||
| () => $gettext('Global progress bar'), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's needed to depend on the locale, wouldn't it be nicer to use
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. current is just a string, so it doesn't trigger reactivity when it changes. I thought the same, but didn't work, unfortunately. :( |
||
| () => { | ||
| extensionRegistry.unregisterExtensions([progressBarExtensionId]) | ||
| extensionRegistry.unregisterExtensionPoints([progressBarExtensionPoint.value.id]) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same worry as in the register function... I do not think other progress bars will survive this. |
||
| progressBarExtensionPoint.value = registerProgressBarExtension() | ||
| } | ||
| ) | ||
|
|
||
| onMounted(async () => { | ||
| await nextTick() | ||
|
|
@@ -236,7 +252,7 @@ export default defineComponent({ | |
| window.removeEventListener('resize', onResize) | ||
|
|
||
| extensionRegistry.unregisterExtensions([progressBarExtensionId]) | ||
| extensionRegistry.unregisterExtensionPoints(unref(extensionPoints).flatMap((e) => e.id)) | ||
| extensionRegistry.unregisterExtensionPoints([progressBarExtensionPoint.value.id]) | ||
| }) | ||
|
|
||
| return { | ||
|
|
||
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'm quite worried what re-registering extension point will do. If there are any other progress bar extensions, are they persisted or are they lost due to this?
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 points. I have to check..I'm not sure. Do you have any other ideas in general? I couldn't come up with anything better. 🙈
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 the computed prop did not work, I have no other idea from top of my head. I would need to dig deeper.
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.
Nope, it didn't work either. Already tried that. I will try to find something else and we can talk tomorrow. 👍🏻