[json + javascript] IJ-CR-129937 Fix wording and utilize message bundle's choice feature

GitOrigin-RevId: 192f55c99b60bfddf8e75f0588bd95e09a05ca4a
This commit is contained in:
Nikita Katkov
2024-03-26 13:33:24 +00:00
committed by intellij-monorepo-bot
parent ea1ff1d62c
commit e710b04569
2 changed files with 8 additions and 6 deletions
@@ -245,5 +245,4 @@ JsonJacksonReformatAction.command.name.json.reformat=JSON Reformat
JsonJacksonReformatAction.dialog.title.json.reformatting=JSON Reformatting
JsonJacksonReformatAction.dialog.message.this.action.not.undoable.do.you.want.to.reformat.document=This action cannot be reverted. Do you want to reformat the document?
folding.collapsed.array.one.element.text=[ {0} element\u2026 ]
folding.collapsed.array.several.elements.text=[ {0} elements\u2026 ]
folding.collapsed.array.one.element.text=[ {0} {1,choice,1#element|2#elements}\u2026 ]
@@ -13,10 +13,13 @@ internal fun getCollectionPsiPresentationText(array: JsonArray): @Nls String {
}
fun getCollectionPsiPresentationText(childrenCount: Int): @Nls String {
return if (childrenCount % 10 == 1) {
JsonBundle.message("folding.collapsed.array.one.element.text", childrenCount)
return if (childrenCount % 10 == 1 && childrenCount % 100 != 11) {
JsonBundle.message("folding.collapsed.array.one.element.text", childrenCount, SINGULAR_FORM)
}
else {
JsonBundle.message("folding.collapsed.array.several.elements.text", childrenCount)
JsonBundle.message("folding.collapsed.array.one.element.text", childrenCount, PLURAL_FORM)
}
}
}
private const val SINGULAR_FORM = 1
private const val PLURAL_FORM = 2