Browse Source

Gradle build: always sort the locale list

merge-requests/1636/merge
Nicolas Pomepuy 11 months ago
committed by Duncan McNamara
parent
commit
7c77013c93
  1. 14
      application/vlc-android/build.gradle

14
application/vlc-android/build.gradle

@ -127,20 +127,20 @@ android {
def generateTranslation() {
def foundLocales = new StringBuilder()
foundLocales.append("new String[]{")
foundLocales.append("new String[]{\"")
def emptyList = []
fileTree("../resources/src/main/res").visit { FileVisitDetails details ->
println 'details: ' + details
if (details.file.path.endsWith("strings.xml")) {
def languageCode = details.file.parentFile.name.replaceAll('values-', '').replaceAll('-r', '-')
languageCode = (languageCode == "values") ? "en" : languageCode
foundLocales.append("\"").append(languageCode).append("\"").append(",")
emptyList.add(languageCode)
}
}
foundLocales.append("}")
//Don't forget to remove the trailing comma
def foundLocalesString = foundLocales.toString().replaceAll(',}', '}')
emptyList.sort()
foundLocales.append(emptyList.join("\",\""))
foundLocales.append("\"}")
def foundLocalesString = foundLocales.toString()
return foundLocalesString
}

Loading…
Cancel
Save