-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathhandleTranslations.sh
executable file
·105 lines (82 loc) · 2.42 KB
/
handleTranslations.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/sh
# verbose and exit on error
set -xe
# import GPG keys
gpg --import /gpg/nextcloud-bot.public.asc
gpg --allow-secret-key-import --import /gpg/nextcloud-bot.asc
gpg --list-keys
# fetch git repo
git clone git@github.com:nextcloud/server /app
# Migrate the transifex config to the new client version
cd /app
tx migrate
git add .tx/config
rm .tx/config_*
git commit -am "Fix(l10n): Update Transifex configuration" -s || true
git push
cd -
# TODO use build/l10nParseAppInfo.php to fetch app names for l10n
versions='master stable31 stable30 stable29'
# build POT files for all versions
mkdir stable-templates
for version in $versions
do
# skip if the branch doesn't exist
if git branch -r | egrep "^\W*origin/$version$" ; then
echo "Valid branch"
else
echo "Invalid branch"
continue
fi
git checkout $version
# build POT files
/translationtool.phar create-pot-files
cd translationfiles/templates/
for file in $(ls)
do
mv $file ../../stable-templates/$version.$file
done
cd ../..
done
# merge POT files into one
for file in $(ls stable-templates/master.*)
do
name=$(echo $file | cut -b 25- )
msgcat --use-first stable-templates/*.$name > translationfiles/templates/$name
done
# remove intermediate POT files
rm -rf stable-templates
# Checkout master so we have the newest .tx/config with the newest list of resources
git checkout master
# push sources
tx push -s
# pull translations - force pull because a fresh clone has newer time stamps
tx pull -f -a --minimum-perc=50
# pull all "lib" translations for the language name
tx pull -a -f -r nextcloud.lib --minimum-perc=0
# pull 20% of "settings" translations for the region name
tx pull -a -f -r nextcloud.settings-1 --minimum-perc=20
for version in $versions
do
# skip if the branch doesn't exist
if git branch -r | egrep "^\W*origin/$version$" ; then
echo "Valid branch"
else
echo "Invalid branch"
continue
fi
git checkout $version
# delete removed l10n files that are used for language detection (they will be recreated during the write)
find core/l10n -type f -delete
find lib/l10n -type f -delete
# build JS/JSON based on translations
/translationtool.phar convert-po-files
# remove tests/
rm -rf tests
git checkout -- tests/
# create git commit and push it
git add apps core lib
git commit -am "Fix(l10n): Update translations from Transifex" -s || true
git push origin $version
echo "done with $version"
done