Skip to content

Commit fdbf0d0

Browse files
committed
fix: refactor DevInBundle to use non-NLS strings and correct bundle name #101
The DevInBundle class has been refactored to use non-NLS strings for improved performance and to correct the bundle name for proper message loading. The `BUNDLE` constant has been renamed to `DevInBUNDLE` to match the file name of the resource bundle. Additionally, the `message` and `messagePointer` methods have been updated to use the correct bundle name and to suppress any warnings from the spread operator. These changes ensure that the internationalization logic is more robust and easier to maintain.
1 parent 6298a3f commit fdbf0d0

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/DevInBundle.kt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import org.jetbrains.annotations.PropertyKey
66

77

88
@NonNls
9-
private const val BUNDLE: String = "messages.DevInBundle"
9+
private const val DevInBUNDLE: String = "messages.DevInBundle"
1010

11-
object DevInBundle : DynamicBundle(BUNDLE) {
12-
@JvmStatic
13-
fun message(@PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any): String = getMessage(key, *params)
11+
object DevInBundle : DynamicBundle(DevInBUNDLE) {
12+
@Suppress("SpreadOperator")
13+
@JvmStatic
14+
fun message(@PropertyKey(resourceBundle = DevInBUNDLE) key: String, vararg params: Any) = getMessage(key, *params)
1415

15-
@JvmStatic
16-
fun messagePointer(@PropertyKey(resourceBundle = BUNDLE) key: String,
17-
vararg params: Any): java.util.function.Supplier<String> = getLazyMessage(key, *params)
16+
@Suppress("SpreadOperator", "unused")
17+
@JvmStatic
18+
fun messagePointer(@PropertyKey(resourceBundle = DevInBUNDLE) key: String, vararg params: Any) =
19+
getLazyMessage(key, *params)
1820
}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1+
inspection.group.name=DevIns language
12
inspection.duplicate.agent=Duplicate agent calls detected. It is recommended to make only one call per agent. Please remove any duplicate agent calls.
2-
inspection.group.name=DevIns language

0 commit comments

Comments
 (0)