Skip to content

Commit

Permalink
improve lang updating
Browse files Browse the repository at this point in the history
  • Loading branch information
leonlatsch committed Jan 21, 2021
1 parent 2e95a70 commit 1a6f650
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.*

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
val kotlinVersion = "1.4.21"
Expand Down Expand Up @@ -37,8 +39,6 @@ tasks.register("updateTranslations") {
}
}

println()

val badges = arrayListOf<String>()
File(resPath).walk().forEach { dir ->
if (dir.isDirectory &&
Expand All @@ -64,8 +64,10 @@ tasks.register("updateTranslations") {
percentage > 0 -> "25-red"
else -> "lightgrey"
}
val localeDisplay = Locale.forLanguageTag(localeName.replace("-r", "-"))
.getDisplayName(Locale.US)
val badge = template
.replace("{locale}", localeName.replace("-", "--"))
.replace("{locale}", localeDisplay.replace(" ", "%20"))
.replace("{percentage}", "${percentage.toInt()}%")
.replace("{color}", color)
badges.add(badge)
Expand Down

0 comments on commit 1a6f650

Please sign in to comment.