Skip to content

Commit d9de3ef

Browse files
committed
Filter out JSON non-string translation entries
Fixes #869
1 parent 0c67035 commit d9de3ef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/kotlin/translations/index/providers.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ object JsonTranslationProvider : TranslationProvider {
5656
return null
5757
}
5858
val obj = json.asJsonObject
59-
return TranslationIndexEntry(domain, obj.entrySet().map { Translation(it.key, it.value.asString) })
59+
val translations = obj.entrySet().asSequence()
60+
.filter { it.value.isJsonPrimitive }
61+
.map { Translation(it.key, it.value.asString) }
62+
.toList()
63+
return TranslationIndexEntry(domain, translations)
6064
}
6165

6266
override fun findElements(project: Project, file: VirtualFile, key: String): List<JsonProperty> {

0 commit comments

Comments
 (0)