2 # lng2po.sh -- translating .lng files to .po files for XBoard/Winboard,
3 # part of XBoard GNU project
5 # Copyright 2011, 2013, 2014, 2015, 2016 Free Software Foundation, Inc.
6 # ------------------------------------------------------------------------
8 # GNU XBoard is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or (at
11 # your option) any later version.
13 # GNU XBoard is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program. If not, see http://www.gnu.org/licenses/. *
21 # ------------------------------------------------------------------------
24 INFO="lng2po.sh (translating .lng files to .po files for XBoard/Winboard)"
25 USAGE="Usage: `basename $0` [-hv] [-o outputfile] [-e encoding] <input.lng>
26 default encoding: latin-1
27 default output file: ./language.po"
35 TMPFILE=`mktemp lng2poXXXXX`
37 # parse command line arguments
38 while getopts hvo:e: OPT; do
43 v) echo "`basename $0` version: $VERSION"
50 \?) # getopts issues an error message
54 :) echo " Error:options -e and -o need an argument"
60 # move past the parsed commands in $@
61 shift `expr $OPTIND - 1`
63 # check if an input file was given and if it exists in ./ or winboard/languages
64 # also check if it's a .lng file
66 echo " Error: Need to specify an input file"
69 if [ ${1: -4} == ".lng" ]; then
72 echo " Error: Input file needs to be a .lng file"
77 if [ -e ../winboard/language/$INPUT ]; then
78 INPUT=../winboard/language/$INPUT
81 if [ -e $INPUT ]; then
85 recode $ENCODING $TMPFILE
86 ed $TMPFILE < metascript
89 ed $OUTPUT < lng2po-helper-script
90 rm lng2po-helper-script
91 echo "created $OUTPUT"
93 echo " Error: Couldn't find input file ($INPUT) in current directory or winboard/languages"