diff --git a/buildSrc/src/main/kotlin/LocalesConfigPlugin.kt b/buildSrc/src/main/kotlin/LocalesConfigPlugin.kt index 8a51e32a69..b1e53fde90 100644 --- a/buildSrc/src/main/kotlin/LocalesConfigPlugin.kt +++ b/buildSrc/src/main/kotlin/LocalesConfigPlugin.kt @@ -6,7 +6,7 @@ import org.gradle.kotlin.dsl.TaskContainerScope fun TaskContainerScope.registerLocalesConfigTask(project: Project): TaskProvider { return with(project) { register("generateLocalesConfig") { - val emptyResourcesElement = "\\s*<\\/resources>|".toRegex() + val emptyResourcesElement = "\\s*|".toRegex() val valuesPrefix = "values-?".toRegex() val languages = fileTree("$projectDir/src/main/res/") @@ -16,14 +16,16 @@ fun TaskContainerScope.registerLocalesConfigTask(project: Project): TaskProvider .filterNot { it.readText().contains(emptyResourcesElement) } + .map { it.parentFile.name } + .sorted() .joinToString(separator = "\n") { - val language = it.parentFile.name + val language = it .replace(valuesPrefix, "") + .replace("-r", "-") .takeIf(String::isNotBlank) ?: "en" " " } - val content = """