mirror of
https://github.com/gsantner/dandelion
synced 2024-11-16 09:22:08 +01:00
.
This commit is contained in:
parent
07acb6bd02
commit
d3a2c20515
4 changed files with 39 additions and 1 deletions
|
@ -14,7 +14,8 @@ android {
|
|||
targetSdkVersion version_setup_targetSdk
|
||||
buildConfigField "boolean", "IS_TEST_BUILD", "false"
|
||||
buildConfigField "boolean", "IS_GPLAY_BUILD", "false"
|
||||
buildConfigField "String[]", "APPLICATION_LANGUAGES", "${getUsedAndroidLanguages()}"
|
||||
//buildConfigField "String[]", "APPLICATION_LANGUAGES", "${getUsedAndroidLanguages()}"
|
||||
resValue "string", "bc_notr__detected_languages", "${getUsedAndroidLanguages()}"
|
||||
buildConfigField "String", "GITHASH", "\"${getGitHash()}\""
|
||||
|
||||
applicationId "com.github.dfa.diaspora_android"
|
||||
|
|
|
@ -121,6 +121,8 @@ public class LanguagePreference extends ListPreference {
|
|||
languages.add(summarizeLocale(locale, langId) + ";" + langId);
|
||||
}
|
||||
}
|
||||
String aa = contextUtils.str("build_conf__detected_languages");
|
||||
String a = aa;
|
||||
|
||||
// Sort languages naturally
|
||||
Collections.sort(languages);
|
||||
|
|
|
@ -100,6 +100,7 @@ public class ContextUtils {
|
|||
public static final String ARRAY = "array";
|
||||
public static final String DIMEN = "dimen";
|
||||
public static final String MENU = "menu";
|
||||
public static final String BOOL = "bool";
|
||||
public static final String RAW = "raw";
|
||||
}
|
||||
|
||||
|
@ -107,6 +108,10 @@ public class ContextUtils {
|
|||
return _context.getString(strResId);
|
||||
}
|
||||
|
||||
public String str(String strResKey) {
|
||||
return str(getResId(ResType.STRING, strResKey));
|
||||
}
|
||||
|
||||
public Drawable drawable(@DrawableRes int resId) {
|
||||
return ContextCompat.getDrawable(_context, resId);
|
||||
}
|
||||
|
|
30
build.gradle
30
build.gradle
|
@ -47,12 +47,42 @@ allprojects {
|
|||
tasks.matching { task -> task.name.matches('.*generate.*Resources') }.all {
|
||||
task -> task.dependsOn copyRepoFiles
|
||||
}
|
||||
|
||||
tasks.matching { task -> task.name.matches('.*generate.*Resources') }.all {
|
||||
task -> task.doLast { markUntranslatableBuildFields() }
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
|
||||
def markUntranslatableBuildFields() {
|
||||
Set<Project> proc_projects = new HashSet<>(subprojects)
|
||||
proc_projects.add(rootProject)
|
||||
|
||||
proc_projects.each { proc_project ->
|
||||
File mergeDir = new File("${proc_project.buildDir}/intermediates/res/merged")
|
||||
if (!mergeDir.exists()) return
|
||||
mergeDir.eachDir { dir ->
|
||||
println("Resources" + dir)
|
||||
dir.eachFileRecurse { file ->
|
||||
if (file.name.endsWith(".xml")) {
|
||||
println(file)
|
||||
String content = file.getText('UTF-8')
|
||||
if (content != null && content.contains('<string name="bc_notr__')) {
|
||||
println("Replacing app name in " + file)
|
||||
content = content.replace('<string name="bc_notr__', '<string translatable="false" name="bc_notr__')
|
||||
file.write(content, 'UTF-8')
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final String[] ROOT_TO_RAW_COPYFILES = ["README.md", "CHANGELOG.md", "CONTRIBUTORS.md", "LICENSE.txt", "LICENSE.md", "LICENSE"]
|
||||
task copyRepoFiles(type: Copy) {
|
||||
from rootProject.files(ROOT_TO_RAW_COPYFILES)
|
||||
|
|
Loading…
Reference in a new issue