Skip to content

Commit 7040646

Browse files
committed
Fix weird translation keys
Fixes #587
1 parent 54b513f commit 7040646

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

rebar/src/main/kotlin/io/github/pylonmc/rebar/i18n/RebarTranslator.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ class RebarTranslator private constructor(private val addon: RebarAddon) : Trans
103103

104104
private fun getRawTranslation(translationKey: String, locale: Locale, warn: Boolean): Component? {
105105
return translationCache.getOrPut(locale to translationKey) {
106-
val (addon, key) = translationKey.split('.', limit = 2)
106+
val parts = translationKey.split('.', limit = 2)
107+
if (parts.size < 2) return null
108+
val (addon, key) = parts
107109
if (addon != addonNamespace) return null
108110
val translations = findCommonLocale(locale)?.let(this.translations::get)
109111
if (translations == null) {

0 commit comments

Comments
 (0)