Skip to content

Commit 4a60a66

Browse files
committed
Sort the json file
1 parent 74e1c6c commit 4a60a66

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • src/main/kotlin/fr/minemobs/pepitedorlocalization/view

src/main/kotlin/fr/minemobs/pepitedorlocalization/view/MainView.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ class MainView : View("Pepite D'or Localization UI") {
7777
if(key.value == null || key.value.isEmpty()) return@action
7878
val jsonFile = File(folderLoc!!, "$it.json")
7979
val reader = FileReader(jsonFile, Charsets.UTF_8)
80-
val map : HashMap<String, String> = LinkedHashMap()
80+
val map : HashMap<String, String> = HashMap()
8181
map.putAll(gson.fromJson(reader, map.javaClass))
8282
map[key.value] = translatedString.value
8383
val writer = FileWriter(jsonFile, Charsets.UTF_8)
84-
gson.toJson(map, writer)
84+
gson.toJson(map.toList().sortedBy { (k, _) -> k }.toMap(), writer)
8585
writer.close()
8686
println("Added \"${key.value}\": \"${translatedString.value}\"")
8787
}

0 commit comments

Comments
 (0)