#!/bin/sh
# Greenbone Security Assistant
# $Id$
# Description: Utility to generate a pot file from gsa JavaScript i18n
#
# Authors:
#  Björn Ricks <bjoern.ricks@greenbone.net>
#
# Copyright:
#  Copyright (C) 2016 Greenbone Networks GmbH
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2,
# or, at your option, any later version as published by the Free
# Software Foundation
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.


SOURCE_BASEDIR=$1
SOURCE_SUBDIR=$2
POT_FILE=$3

if [ -z "$SOURCE_DIR" ]; then
  SOURCE_DIR=`dirname $0`/../src/html/classic/js
fi

if [ -z "$POT_FILE" ]; then
  POT_FILE=`dirname $0`/../src/po/gsad-js.pot
fi


mkdir -p `dirname $POT_FILE`

cd "$SOURCE_BASEDIR"
xgettext --from-code=UTF-8 -o $POT_FILE -L JavaScript ./$SOURCE_SUBDIR/*.js
