forked from arduino/arduino-ide
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: defer initializing i18n at backend startup
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
- Loading branch information
Akos Kitta
committed
Sep 12, 2023
1 parent
2071ab8
commit b788005
Showing
3 changed files
with
30 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 0 additions & 13 deletions
13
arduino-ide-extension/src/node/theia/plugin-ext/hosted-plugin-localization-service.ts
This file was deleted.
Oops, something went wrong.
25 changes: 25 additions & 0 deletions
25
arduino-ide-extension/src/node/theia/plugin-ext/plugin-localization-backend-contribution.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { injectable, postConstruct } from '@theia/core/shared/inversify'; | ||
import { PluginLocalizationBackendContribution as TheiaPluginLocalizationBackendContribution } from '@theia/plugin-ext/lib/main/node/plugin-localization-backend-contribution'; | ||
|
||
@injectable() | ||
export class PluginLocalizationBackendContribution extends TheiaPluginLocalizationBackendContribution { | ||
@postConstruct() | ||
protected init(): void { | ||
this.pluginDeployer.onDidDeploy(() => { | ||
this.pluginsDeployed.resolve(); | ||
}); | ||
} | ||
|
||
override async initialize(): Promise<void> { | ||
// Unlike Theia, IDE2 does not await here. | ||
// Otherwise the backend app startup is blocked until all translations are read. | ||
// https://github.com/eclipse-theia/theia/blob/cb426569d1d5fe42567f5ec5d35b3c77a92f3295/packages/core/src/node/i18n/localization-backend-contribution.ts#L36-L37 | ||
this.localizationRegistry | ||
.initialize() | ||
.then(() => this.initialized.resolve()); | ||
} | ||
|
||
override async waitForInitialization(): Promise<void> { | ||
await Promise.all([this.initialized.promise, this.pluginsDeployed.promise]); | ||
} | ||
} |