diff --git a/CHANGELOG.md b/CHANGELOG.md index f962b30d4..212bf85a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ### v1.2.4 - Updated: Readme +- Fixed: Language list when building outside of project root ### v1.2.3 - Added: Option to change app language diff --git a/app/build.gradle b/app/build.gradle index 77206d6f3..e57327b87 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -59,16 +59,16 @@ android { sourceSets { main { assets.srcDirs = ['src/main/assets', '../assets'] } } } -String[] getUsedAndroidLanguages(){ - Set langs = new HashSet<>(); - String[] resFolders = new File("app/src/main/res").list() - for(resFolder in resFolders){ - if (resFolder.startsWith("values-")){ - String[] files = new File("app/src/main/res/"+resFolder).list(); - for (file in files){ - if (file.startsWith("strings") && file.endsWith(".xml")){ - langs.add(resFolder.replace("values-","")) - break; +@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection"]) +static String[] getUsedAndroidLanguages() { + Set 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(" langs = new HashSet<>(); - String[] resFolders = new File("app/src/main/res").list() - for(resFolder in resFolders){ - if (resFolder.startsWith("values-")){ - String[] files = new File("app/src/main/res/"+resFolder).list(); - for (file in files){ - if (file.startsWith("strings") && file.endsWith(".xml")){ - langs.add(resFolder.replace("values-","")) - break; - } +buildConfigField("String[]", "APPLICATION_LANGUAGES", '{' + getUsedAndroidLanguages().collect {"\"${it}\""}.join(",") + '}') + +@SuppressWarnings(["UnnecessaryQualifiedReference", "SpellCheckingInspection"]) +static String[] getUsedAndroidLanguages() { + Set 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(" diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index f72f63603..536a138ba 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -87,4 +87,8 @@ Esconder barra de status Qualidade e tamanho. Valores altos causam mais tempo de carregamento. Dependendo do processador e o tamanho da imagem o app pode falhar se o valor extrapolar 25%. Qualidade da pré-visualização + + + Idioma + Muda o idioma do aplicativo. Reinicie o aplicativo para que as alterações entrem em vigor