collect_translation.sh 1.12 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash
#
# collect all translation files in one dir
#
# preparation: (https://projects.gwdg.de/projects/textgrid-laboratory?jump=welcome)
#
#  git clone --recursive git://git.projects.gwdg.de/textgrid-laboratory.git
#  cd textgrid-laboratory
#  git checkout develop
#  git submodule update --remote

12
PROPFILE_MATCH="bundle*.properties plugin*.properties messages*.properties about*.properties"
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
COLLECT_DIR=translations
SLASH_REPLACE=_._

SCRIPT=$(readlink -f "$0")
DIR=$(dirname "$SCRIPT")
OLDDIR=`pwd`
cd $DIR

if [ ! -d $COLLECT_DIR ]; then
  echo "creating dir $COLLECT_DIR"
  mkdir $COLLECT_DIR
fi

for prm in $PROPFILE_MATCH; do
  echo "collecting with pattern ${prm}"
  propfiles=`find . -name $prm`

  for propfile in $propfiles; do

    if [[ $propfile == *$SLASH_REPLACE* ]]; then
      echo "origin $propfile contains replacement pattern in path, you should change the variable SLASH_REPLACE"
    else
      newname=${propfile:2}
      newname=${newname//\//$SLASH_REPLACE}
      cp $propfile $COLLECT_DIR/$newname &> /dev/null
    fi
  done

done

cd $OLDDIR
echo "all translation files collected in directory $DIR/$COLLECT_DIR"