forked from hyphanet/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
transifex-pull
executable file
·55 lines (47 loc) · 2.11 KB
/
transifex-pull
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
#!/bin/bash
set -o errexit
# Pull translation updates from Tranfiex.
# Even in developer mode the Transifex Client (https://github.com/transifex/transifex-client)
# includes commented-out untranslated lines, which is not suitable for committing.
# Set language pattern associations with:
# tx set --auto-local -r <project.resource> '<expr>' --source-lang en -t MOZILLAPROPERTIES
# Set exceptions with:
# tx set -r freenet.<lower-case resource name> -l <language code> <file path>
# These exceptions will be where Freenet differs from Transifex codes:
# * zh_CN -> zh-cn
# * zh_TW -> zh-tw
# * pt_BR -> pt-br
# See http://support.transifex.com/customer/portal/articles/996071-setup-and-sync-with-tx
# for details.
# Load configuration and utility functions.
source freenet-scripts-common || exit
# TODO: Move to freenet-scripts-common?
starting_directory="$(readlink -e "$(dirname "$0")")"
function filter() {
for file in $1
do
# Remove commented lines
sed -i '/^#/d' "$file"
# Remove backslash before :
sed -i 's/\\\:/:/g' "$file"
# Remove backslash before !
sed -i 's/\\!/!/g' "$file"
done
}
# Takes absolute repo path, resource name, localization path relative to the
# repo path, and localization glob.
function pull() {
cd "$1"
tx pull -r "freenet.$2" --mode=default --minimum-perc=30 -a -f
cd "$(dirname "$3")"
filter "$4"
cd "$starting_directory"
python3 remove-untranslated.py "$1/$3" "$4"
}
# These expressions are more permissive than they need to be but are sufficient.
pull "$fredDir" master "src/freenet/l10n/freenet.l10n.en.properties" "freenet.l10n.*.properties"
# TODO: Support directories named something other than the repo name
pull "$freenetRoot/plugin-FlogHelper" floghelper "src/plugins/floghelper/l10n/UI_en.l10n" "UI_*.l10n"
pull "$freenetRoot/plugin-Freemail" freemail "src/org/freenetproject/freemail/l10n/lang_en.l10n" "lang_*.l10n"
pull "$freenetRoot/plugin-KeyUtils" keyexplorer "src/main/resources/plugins/KeyUtils/intl/en.txt" "*.txt"
pull "$freenetRoot/plugin-WebOfTrust" weboftrust "src/plugins/WebOfTrust/l10n/lang_en.l10n" "lang_*.l10n"