Skip to content

Commit 5fa08f2

Browse files
committed
build: add task to sync localisations with Crowdin
Signed-off-by: Harsh Shandilya <[email protected]>
1 parent 35f8687 commit 5fa08f2

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

build.gradle

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,39 @@ buildscript {
3333
}
3434
}
3535

36+
plugins {
37+
id "de.undercouch.download" version "4.1.1"
38+
}
39+
40+
task downloadCrowdin(type: Download) {
41+
src 'https://crowdin.com/backend/download/project/wireguard.zip'
42+
dest file('build/translations.zip')
43+
overwrite true
44+
}
45+
46+
task cleanCrowdin(type: Delete) {
47+
delete 'ui/src/main/res/values-*/strings.xml'
48+
}
49+
50+
task extractCrowdin(type: Copy, dependsOn: ['downloadCrowdin', 'cleanCrowdin']) {
51+
mustRunAfter 'downloadCrowdin'
52+
from zipTree(file('build/translations.zip'))
53+
into file('build/translations')
54+
doFirst {
55+
delete 'build/translations'
56+
}
57+
}
58+
59+
task crowdin(type: Copy, dependsOn: ['extractCrowdin']) {
60+
mustRunAfter 'extractCrowdin'
61+
from 'build/translations/wireguard-android/ui/src/main/res'
62+
into 'ui/src/main/res/'
63+
doLast {
64+
delete 'build/translations'
65+
delete 'build/translations.zip'
66+
}
67+
}
68+
3669
allprojects {
3770
repositories {
3871
google()

0 commit comments

Comments
 (0)