Line 85: |
Line 85: |
| #!/bin/bash | | #!/bin/bash |
| # | | # |
− | | + | #SME Server Create lexocon .po |
− | function usage {
| + | |
− | echo ""
| + | if [ -f $1 ] |
− | echo "Create po"
| |
− | echo ""
| |
− | echo "Not enough parameters provided."
| |
− | echo "Usage: $0 LexiconFilename"
| |
− | }
| |
− |
| |
− | #check for required parameters
| |
− | if [ ${#1} -gt 0 ] | |
| then | | then |
| + | #convert to UTF-8 while working on pootle |
| + | mv $1 $1.bak |
| + | /usr/bin/iconv -f ISO-8859-1 -t UTF-8 $1.bak > $1 |
| | | |
− | cp $1 $1.bak
| + | #echo "Remove CDATA and reformat problem codes in $1" |
− |
| |
− | #echo "Remove CDATA in $1" | |
| perl -pi -e 's/<!\[CDATA\[/STARTCDATA/g' $1 | | perl -pi -e 's/<!\[CDATA\[/STARTCDATA/g' $1 |
| perl -pi -e 's/\]\]>/ENDCDATA/g' $1 | | perl -pi -e 's/\]\]>/ENDCDATA/g' $1 |
Line 106: |
Line 99: |
| perl -pi -e 's/P\>/p\>/g' $1 | | perl -pi -e 's/P\>/p\>/g' $1 |
| perl -pi -e 's/A\>/a\>/g' $1 | | perl -pi -e 's/A\>/a\>/g' $1 |
| + | #perl -pi -e 's/i\>/ITAALIC/g' $1 |
| + | perl -pi -e 's/\<(br|BR)\>/breeak/g' $1 |
| + | perl -pi -e 's/\<\/(font|FONT)\>//g' $1 |
| | | |
| #echo "Create $1.po" | | #echo "Create $1.po" |
Line 114: |
Line 110: |
| perl -pi -e 's/ENDCDATA/\]\]>/g' $1.po | | perl -pi -e 's/ENDCDATA/\]\]>/g' $1.po |
| perl -pi -e 's/AMP/\&/g' $1.po | | perl -pi -e 's/AMP/\&/g' $1.po |
| + | #perl -pi -e 's/ITAALIC/i\>/g' $1.po |
| + | perl -pi -e 's/breeak/\<br\>/g' $1.po |
| | | |
− | mv $1.bak $1 | + | #basic testing |
− |
| + | A=`cat $1.bak |grep '<entry>' |wc -l` |
| B=`cat $1.po |grep msgid |wc -l` | | B=`cat $1.po |grep msgid |wc -l` |
− | C=`cat $1 |grep '<entry>' |wc -l` | + | C=`expr $B - 1` |
− | D=`expr $B - 1`
| + | echo "entries $A, msgid $C" |
− | E=`expr $B - $C`
| |
− | echo "entries $C, msgid $D" | |
| | | |
− | if [ $E -gt 1 ] | + | if [ $A -ne $C ] |
| then | | then |
− | echo "Errors in formatting"
| + | echo "Errors in formatting" |
− | tail $1.po
| + | tail $1.po |
| fi | | fi |
| + | |
| + | #restore original |
| + | mv $1.bak $1 |
| | | |
− | if [ $E -lt 1 ] | + | if [ ${#2} -gt 0 ] |
| then | | then |
− | echo "Errors or duplicate <trans> value"
| + | echo "<base> entries" |
− | tail $1.po
| + | cat $1 |grep base |sort |
| fi | | fi |
− |
| + | |
| else | | else |
| #print usage informamtion | | #print usage informamtion |
− | usage | + | echo "Usage: $0 LexiconFilename" |
| + | echo "Usage: $0 LexiconFilename check" |
| fi | | fi |
| | | |