Modify ActionMenuNode

I’m trying to localize, I want to change the contents of ActionMenuNode to change the display in the menu bar, but these properties are readonly, how can I change them.

Hi @kingkiller. Localization/Internationalization support for Theia is currently in the review stage (See this PR). We are trying to include it into the August release (1.17.0). With this, localization should be a breeze.

However, If it’s a pressing issue, you can override this method and create a custom menu node there which contains your translated value. I wouldn’t recommend doing this though, as the i18n PR will take care of that.

thanks,I’m looking forward to the internationalization support in version 1.7. I can also mention some of the problems AND solutions I encountered in localization. I hope this will be helpful to you

I would like to ask if internationalization is included in version 1.7.0. I updated to the latest version, but found no internationalization feature

@kingkiller

It is included, but only partially. We will have full support with the 1.18 update. For now, you are able to install language packs for different languages in Theia and change the current language using the Configure Display Language command. However, it only changes two things: The Configure Display Language command will be displayed in the selected language. Extensions that are available in the selected language will run using the language.

Theia’s own translation will be done this month. You can start to translate your own extension already. For this, please use the LocalizationContribution:

thanks

Is there any example code that shows how to use localized Contribution

Hi @kingkiller,

currently none, though I’ll write something up this week as I am currently working on translating Theia (see this or this PR and Theia’s own translation will follow this week as well). However, I can give you short example:

// creating your own localization contribution for simplified chinese
export class CustomLocalizationContribution implements LocalizationContribution {
    async registerLocalization(registry: LocalizationRegistry): Promise<void> {
        registry.registerLocalizationFromRequire('zh-cn', require('../data/i18n/translation.json');
    }
}

The file itself has to be a key-value json:

{
    "key1": "value1",
    "key2": "value2"
}

You can use this by importing the nls namespace from the Theia browser package:

text = nls.localize('key1', 'default english value');

There is also a utility method for commands:

command = Command.toLocalizedCommand({
    id: 'id',
    label: 'value1'
}, 'key1');

At present, it seems that your implementation method is similar to mine. Thank you very much for your work. It would be perfect if you could give a localization extension case in your spare time. I have noticed that some command lable properties are read-only and cannot be changed. Is it now possible to change it directly through the API you provide