I18n How do I change the default language

I found in the latest Theia repository that Theia has done a lot of language translation work, but if you don’t install extensions for the language, the default language is English.

So how can we use the translations already provided by the authorities?

Hi @kingkiller,

as outlined by the i18n documentation, languages only appear once you’ve installed the corresponding language pack. Simply search for the language in the vsx-registry view and you should get the option to download and install it. Afterwards you can switch to it using the Configure Display Language command.

If you’re asking how to change the default language afterwards, you need to change the defaultLocale in your frontend application config.

Thank you for your reply. I just noticed that the official translation work has been done, but I feel it is a waste that I cannot use the official translation to switch languages. I hope that such a function can be added later. How do I finally change the default language, do I need some extensions to configure it, or do I do it in package.json, as I did with the default theme? Is there any case that can provide reference?

The “official” translation only contains roughly 10% of all that’s translatable in Theia. These are only special strings which do not exist in VSCode language packs. One example of this would be the toolbar package, which is Theia exclusive. For everything else we use language packs.

do I do it in package.json, as I did with the default theme?

Yes, it’s exactly the same as with the defaultTheme, just called defaultLocale. You still need to install the language pack extension of your default locale in order for it to work correctly. You can include these by default in your app using the theiaPlugins property in your package.json.

how to change defaultLocale using api

@wenqi You can always change the language through the nls.locale variable. See: