Skip to content

Commit 5bdfd3a

Browse files
committed
refactor: fallback to the IDE locale instead of the JVM default locale
This ensures that plugin uses the language set for the IDE. Closes: #126
1 parent 56766d9 commit 5bdfd3a

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/main/kotlin/com/github/lppedd/cc/CCRegistry.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.github.lppedd.cc
22

3+
import com.intellij.l10n.LocalizationUtil
34
import com.intellij.openapi.util.registry.Registry
45
import java.util.*
56

@@ -13,9 +14,9 @@ internal object CCRegistry {
1314
fun getLocale(): Locale {
1415
val value = Registry.get(CC.Registry.Locale)
1516
return when (value.selectedOption) {
16-
"English (en_US)" -> Locale.ENGLISH
17-
"Chinese (zh_CN)" -> Locale.SIMPLIFIED_CHINESE
18-
else -> Locale.getDefault()
17+
"English" -> Locale.ROOT
18+
"Chinese (Simplified)" -> Locale.SIMPLIFIED_CHINESE
19+
else -> LocalizationUtil.getLocale()
1920
}
2021
}
2122

src/main/resources/META-INF/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@
103103
<registryKey
104104
key="com.github.lppedd.cc.locale"
105105
description="Set the UI locale"
106-
defaultValue="[Default*|English (en_US)|Chinese (zh_CN)]"
106+
defaultValue="[Default*|English|Chinese (Simplified)]"
107107
/>
108108
<registryKey
109109
key="com.github.lppedd.cc.providers.vcs"

0 commit comments

Comments
 (0)