File: convert_to_java.sh

package info (click to toggle)
qabcs 1.0.2-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 44,724 kB
  • sloc: cpp: 2,226; sh: 2,001; xml: 25; makefile: 5
file content (47 lines) | stat: -rwxr-xr-x 1,022 bytes parent folder | download | duplicates (3)
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
#/bin/sh
# Author: Alexey Loginov
# Licence: GPLv3+
# Description: get translated words from properties files
# You need this script to convert already translated properties files into
# JAVA UTF8 format and upload resulted file into transifex

lang="$1"

if [ -z "$lang" ]
then
   echo "Parameter 'lang' is mandatory!"
   exit 1
fi

pushd ..

rm -f langs/$lang.properties.tmp
rm -f langs/$lang.properties

for dir in `dir abcs/all/pics`
do
  cat abcs/$lang/abc*.properties|grep "$dir:" >> langs/$lang.properties.tmp
done

while read line
do
  key=`echo $line|cut -d "=" -f 4`
  word=`echo $line|cut -d "=" -f 2|sed "s|_| |g"|awk '{print tolower($0)}'`
  if [ -z "$key" ]
  then
    rm -f langs/$lang.properties.tmp
    rm -f langs/$lang.properties
    popd
    echo "Syntax error in line: $line"
    exit 1
  fi
  echo "$key=$word" >> langs/$lang.properties
done < langs/$lang.properties.tmp

sed -i "/^=$/d" langs/$lang.properties

rm -f langs/$lang.properties.tmp

popd

echo "File langs/$lang.properties was written!"