-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplyLocalization.sh
More file actions
executable file
·41 lines (31 loc) · 945 Bytes
/
applyLocalization.sh
File metadata and controls
executable file
·41 lines (31 loc) · 945 Bytes
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
#!/bin/bash
MASTER_DIR=`pwd`
MASTER="English.lproj"
LOCALIZATIONS=`ls | fgrep lproj`
for LANGUAGE in $LOCALIZATIONS
do
if [[ -d $LANGUAGE && $LANGUAGE != $MASTER ]]; then
echo -e "\nProcessing $LANGUAGE localization"
cd $LANGUAGE
NIB_DICTS=`ls *.strings`
for DICT in $NIB_DICTS
do
NIB_FILE=`echo -n $DICT | awk -F "." '{print $1}'`.nib
# If the master nib file exists, translate it
if [ -d ${MASTER_DIR}/${MASTER}/${NIB_FILE} ]; then
echo "Translating ${NIB_FILE}"
TEMP_NIB_FILE=tmp.nib
# Check if the target nib file already exists
if [ -d ${NIB_FILE} ]; then
nibtool -I ${NIB_FILE} -w ${TEMP_NIB_FILE} -d ${DICT} ${MASTER_DIR}/${MASTER}/${NIB_FILE}
cp ${TEMP_NIB_FILE}/* ${NIB_FILE}
rm -rf ${TEMP_NIB_FILE}
else
nibtool -w ${TEMP_NIB_FILE} -d ${DICT} ${MASTER_DIR}/${MASTER}/${NIB_FILE}
mv ${TEMP_NIB_FILE} ${NIB_FILE}
fi
fi
done
cd $MASTER_DIR
fi
done