mirror of
https://github.com/gsantner/dandelion
synced 2025-09-09 18:29:47 +02:00
Make use of opoc/LanguagePreference (fixes #169)
This commit is contained in:
parent
4ba1b8671d
commit
184de1931e
3 changed files with 38 additions and 17 deletions
|
@ -32,6 +32,7 @@ android {
|
|||
|
||||
buildConfigField "boolean", "IS_TEST_BUILD", "false"
|
||||
buildConfigField "boolean", "IS_GPLAY_BUILD", "false"
|
||||
buildConfigField("String[]", "APPLICATION_LANGUAGES", '{' + getUsedAndroidLanguages().collect {"\"${it}\""}.join(",") + '}')
|
||||
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
}
|
||||
|
@ -92,6 +93,23 @@ dependencies {
|
|||
annotationProcessor "com.jakewharton:butterknife-compiler:${version_lib.butterknife}"
|
||||
}
|
||||
|
||||
@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection"])
|
||||
static String[] getUsedAndroidLanguages() {
|
||||
Set<String> langs = new HashSet<>()
|
||||
new File('.').eachFileRecurse(groovy.io.FileType.DIRECTORIES) {
|
||||
final foldername = it.name
|
||||
if (foldername.startsWith('values-') && !it.canonicalPath.contains("build" + File.separator + "intermediates")) {
|
||||
new File(it.toString()).eachFileRecurse(groovy.io.FileType.FILES) {
|
||||
if (it.name.toLowerCase().endsWith(".xml") && it.getCanonicalFile().getText('UTF-8').contains("<string")) {
|
||||
langs.add(foldername.replace("values-", ""))
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return langs.toArray(new String[langs.size()])
|
||||
}
|
||||
|
||||
// #####################
|
||||
// Groovy Coding Area
|
||||
// #####################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue