krasa / StringManipulation

IntelliJ plugin - https://plugins.jetbrains.com/plugin/2162
Apache License 2.0
694 stars 81 forks source link

Feature Request - Enable Chinese UI only when the Chinese Lang Pack is enabled #200

Open jonathanlermitage opened 1 year ago

jonathanlermitage commented 1 year ago

I would like to suggest something: for now, the Chinese UI is enabled if the system's locale is set to zh.
Meanwhile, some Chinese users may want to keep the English UI. Also, other users may want to enable the Chinese UI on non-zh locale (per example, on a corporate computer).
A solution is to detect the official Chinese Language Pack, then load the Chinese resource bundle, and do NOT rely on the system's locale.

A contributor suggested me this feature on another plugin, and this is how I implemented it:

That also means you cannot use the GUI form designer in order to link the labels strings to a resource bundle (double-click on a field, then pick a resource bundle and an i18n key). Instead, you have to set the fields strings manually:

Nota: there is one downside -> you cannot translate IDE settings menu items (in the left panel), because you have to give the resource bundle name in settings.xml, so you cannot invoke the code which selects the right resource bundle (there is an open issue for that).

krasa commented 1 year ago

Thanks. The whole situation sucks.

I have too many UIs to do it programmatically. I think the best would be to somehow do multiple releases with Gradle - one normal and one Chinese - https://plugins.jetbrains.com/plugin/2162-string-manipulation/versions/chinese Then advertise it inside the IDE for people with Zh locale + an action that would add https://plugins.jetbrains.com/plugins/list?channel=chinese&pluginId=2162 to plugin repositories.

For now, I made a new release without Chinese.

jonathanlermitage commented 1 year ago

I see, I totally agree. Thx for the explanation! 👍

jonathanlermitage commented 1 year ago

If you want to suggest a plugin, you can use this api: https://plugins.jetbrains.com/docs/intellij/ide-infrastructure.html#plugin-suggestions

jinxiangqiang commented 1 year ago

The Chinese version has not been updated simultaneously, which is simply too uncomfortable for me with updating obsessive-compulsive disorder

jonathanlermitage commented 1 year ago

The Chinese version has not been updated simultaneously, which is simply too uncomfortable for me with updating obsessive-compulsive disorder

I think contributions are welcome :-)
Internationalization files are located here: https://github.com/krasa/StringManipulation/tree/master/src/main/resources/messages

krasa commented 1 year ago

The Chinese version has not been updated simultaneously, which is simply too uncomfortable for me with updating obsessive-compulsive disorder

Yeah, I need to automate it.