Skip to content

Commit 1fcb5e3

Browse files
authored
Merge pull request #81 from 0verEngineer/fix_messages_bundle
Fixed settings not opening with non default locales
2 parents f9edd9b + 47e621b commit 1fcb5e3

File tree

6 files changed

+16
-29
lines changed

6 files changed

+16
-29
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44

55
## [Unreleased]
66

7+
## [0.5.8]
8+
### Fixed
9+
- Fixed settings not opening with non default locales
10+
711
## [0.5.7]
812
### Changed
913
- Added feature to enable and disable all problems with a keybind (thanks to khopland)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ pluginGroup = org.OverEngineer
22
pluginName = InlineProblems
33
pluginRepositoryUrl = https://github.com/OverEngineer/InlineProblems
44
# SemVer format -> https://semver.org
5-
pluginVersion = 0.5.7
5+
pluginVersion = 0.5.8
66

77
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
88
pluginSinceBuild = 212.5

src/main/java/org/overengineer/inlineproblems/bundles/SettingsBundle.java

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,47 +3,28 @@
33
import com.intellij.DynamicBundle;
44
import org.jetbrains.annotations.Nls;
55
import org.jetbrains.annotations.NonNls;
6-
import org.jetbrains.annotations.NotNull;
76
import org.jetbrains.annotations.PropertyKey;
87

9-
import java.util.Locale;
10-
import java.util.ResourceBundle;
118
import java.util.function.Supplier;
129

13-
/**
14-
* The SettingsBundle class is a dynamic bundle for managing internationalized messages.
10+
/* The SettingsBundle class is a dynamic bundle for managing internationalized messages.
1511
* It extends the DynamicBundle class.
16-
*
17-
* @author kuwei
1812
*/
1913
public final class SettingsBundle extends DynamicBundle {
2014
@NonNls
21-
public static final String BUNDLE = "messages.SettingsBundle";
22-
23-
private static final ResourceBundle DEFAULT_BUNDLE = ResourceBundle.getBundle(BUNDLE, Locale.ENGLISH);
24-
15+
private static final String BUNDLE = "messages.SettingsBundle";
2516
private static final SettingsBundle INSTANCE = new SettingsBundle();
2617

2718
private SettingsBundle() {
2819
super(BUNDLE);
29-
try {
30-
ResourceBundle.getBundle(BUNDLE, Locale.getDefault());
31-
} catch (Exception e) {
32-
Locale.setDefault(Locale.ENGLISH);
33-
}
3420
}
3521

36-
@NotNull
37-
public static @Nls String message(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
38-
return INSTANCE.messageOrDefault(key, DEFAULT_BUNDLE.getString(key), params);
22+
@Nls
23+
public static String message(@PropertyKey(resourceBundle = BUNDLE) String key, Object... params) {
24+
return INSTANCE.getMessage(key, params);
3925
}
4026

41-
@NotNull
42-
public static Supplier<@Nls String> messagePointer(@NotNull @PropertyKey(resourceBundle = BUNDLE) String key, Object @NotNull ... params) {
43-
var result = INSTANCE.messageOrNull(key, params);
44-
if (result == null) {
45-
return () -> DEFAULT_BUNDLE.getString(key);
46-
}
47-
return () -> result;
27+
public static Supplier<String> messagePointer(@PropertyKey(resourceBundle = BUNDLE) String key, Object... params) {
28+
return INSTANCE.getLazyMessage(key, params);
4829
}
4930
}

src/main/java/org/overengineer/inlineproblems/settings/SettingsComponent.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public SettingsComponent() {
185185
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.problemFilterListLabel")), problemFilterList)
186186
.addTooltip(SettingsBundle.message("settings.problemFilterListTooltip"))
187187
.addLabeledComponent(new JLabel(SettingsBundle.message("settings.fileExtensionBlacklistLabel")), fileExtensionBlacklist)
188-
.addTooltip(SettingsBundle.message("settings.fileExtensionBlaclistTooltip"))
188+
.addTooltip(SettingsBundle.message("settings.fileExtensionBlacklistTooltip"))
189189
.addSeparator()
190190
.addComponent(new JBLabel(SettingsBundle.message("settings.submenu.colors")))
191191
.addComponent(showErrors)

src/main/resources/messages/SettingsBundle_en.properties renamed to src/main/resources/messages/SettingsBundle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ settings.inlaySizeDeltaTooltip=Used to have smaller font size for the inlays, sh
2929
settings.problemFilterListLabel=Problem filter list
3030
settings.problemFilterListTooltip=Semicolon separated list of problem text beginnings that will not be handled
3131
settings.fileExtensionBlacklistLabel=File extension blacklist
32-
settings.fileExtensionBlaclistTooltip=Semicolon separated list of file extensions to ignore (like ".java;.md")
32+
settings.fileExtensionBlacklistTooltip=Semicolon separated list of file extensions to ignore (like ".java;.md")
3333
settings.submenu.colors=Colors
3434
settings.errorTextColor=Error text color:
3535
settings.errorLabelBorderColor=Error label border color:

src/main/resources/messages/SettingsBundle_zh_CN.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ settings.inlaySizeDelta=\u5b57\u4f53\u5927\u5c0f\u5dee\u5f02
2828
settings.inlaySizeDeltaTooltip=\u7528\u4e8e\u4e3a\u6807\u7b7e\u8bbe\u7f6e\u8f83\u5c0f\u7684\u5b57\u4f53\uff0c\u5fc5\u987b\u5c0f\u4e8e\u7f16\u8f91\u5668\u5b57\u4f53\u5927\u5c0f
2929
settings.problemFilterListLabel=\u95ee\u9898\u8fc7\u6ee4\u5217\u8868
3030
settings.problemFilterListTooltip=\u4e0d\u5904\u7406\u7684\u95ee\u9898\u6587\u672c\u5f00\u5934\u7684\u7528\u5206\u53f7\u5206\u9694\u7684\u5217\u8868
31+
settings.fileExtensionBlacklistLabel=File extension blacklist
32+
settings.fileExtensionBlacklistTooltip=Semicolon separated list of file extensions to ignore (like ".java;.md")
3133
settings.submenu.colors=\u989C\u8272
3234
settings.errorTextColor=\u9519\u8BEF\u6587\u672C\u989C\u8272\uFF1A
3335
settings.errorLabelBorderColor=\u9519\u8BEF\u6807\u7B7E\u8FB9\u6846\u989C\u8272\uFF1A

0 commit comments

Comments
 (0)