-
The current Theia didn't support I18N now, all the menus's label is hard coded in English. I want to register a new menu item without hard code in Theia. The following is what I did:
The question is, before the "registerMenus" executed, the retrieved preference always showing null or default value, not the value in setting file. I guess, the Theia inital the project preferece kind of service is behind the others. After the Theia initial phase, the PrefereceService can get the correct value, seems in this situation, I lost the chance to register the menu with correct label. Any hint how should I get the correct preference setting before "registerMenus"? Following is the sample code. Thank you. @Injectable()
} |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 12 replies
-
I did not try it (you can expect better support and faster response time if you prepare a public repository with your changes) but there is a Can you try something like this: class YourFrontentContribution implements FrontendApplicationContributions {
@inject (PreferenceService) protected readonly ps: PreferenceService;
@inject (MenuModelRegistry) protected readonly mr: MenuModelRegisytr;
onStart(): Promise<void> {
await this.ps.ready;
// get the preference values
this.mr.unregister
this.mr.register
}
} |
Beta Was this translation helpful? Give feedback.
-
@kittaakos Thanks for your reply, I am trying your solution. Here is my testing project. Thanks. Will keep update once I got something. |
Beta Was this translation helpful? Give feedback.
I did not try it (you can expect better support and faster response time if you prepare a public repository with your changes) but there is a
PreferenceService#ready
, once the promise resolved, you do the menu registry modifications. Note, you won't be able to use theregisterMenus
hooks, as they're sync.Can you try something like this: