-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Missing i18n for Submenu Labels under "Select" Menu #14995
Comments
Thank you very much for this report. It seems you already found a solution, would you be interested in contributing this and get the credits? |
Note that this isn't the right approach for localization of Monaco contributed labels. I wasn't aware of this, but it seems like the code for localizing Monaco was removed, see here. This will need to be re-enabled again. |
I had a quick look and it seems like putting the code back does not cause any major trouble, but it seems that the Monaco localisation code has change in the mean time. Not all menus are localized when restoring the code "as is". |
I particular, a |
I'll take a look at this on Monday, in case you aren't already on it @tsmaeder (I don't work on Fridays) |
Adding the following code fixes most of the problems:
However, there are some problems, in particular the "Paste" action in the editor context menu is not internationalized. I'll let you apply your greater experience with the topic on Monday :-) |
I've created #15016 to fix this. |
Problem Description
Submenu labels under the Select menu (e.g., "All", "Line", "Word") fail to display translated text when using non-English locales. This occurs because the menu labels in
monaco-menu.ts
were not properly internationalizedOriginal Code:
In
@theia/monaco/src/browser/monaco-menu.ts
, thebuildMenuAction
method did not apply localization handling to thelabel
field. The original code directly used the raw label without passing it through the i18n system.Modified Code:
Environment:
Steps to Reproduce
Expected Behavior: Labels should display translated text according to the configured locale.
Actual Behavior: Labels show raw English text.
Proposed Fix
Added
nls.localizeByDefault()
to ensure labels are processed for internationalization. Below is the code change:protected buildMenuAction(commandId: string, item: IMenuItem): MenuAction { const title = typeof item.command.title === 'string' ? item.command.title : item.command.title.value; let label = this.removeMnemonic(title); const order = item.order ? String(item.order) : ''; + label = nls.localizeByDefault(label); return { commandId, order, label }; }
The text was updated successfully, but these errors were encountered: