Last active
December 14, 2019 13:01
-
-
Save olshevski/c82aa02d3977eb49555d88390c46982f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final String TWINE_INPUT_FILE = "${projectDir}/translations/twine.txt" | |
final String TWINE_OUTPUT_DIR = "${projectDir}/build/generated/twine" | |
android.applicationVariants.all { variant -> | |
variant.registerGeneratedResFolders(files(TWINE_OUTPUT_DIR)) | |
} | |
task generateLocalizations { | |
description "Generates localizations from twine.txt file." | |
inputs.file(TWINE_INPUT_FILE) | |
outputs.dir(TWINE_OUTPUT_DIR) | |
doLast { | |
String resourceFolder = "${TWINE_OUTPUT_DIR}/values" | |
mkdir resourceFolder | |
exec { | |
commandLine 'bundle', 'exec', 'twine', 'generate-localization-file', | |
TWINE_INPUT_FILE, "${resourceFolder}/generated_strings.xml", | |
'--format', 'android', '--lang', 'en' | |
} | |
} | |
} | |
preBuild.dependsOn generateLocalizations |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment