3 # --------------------------------------------------------------------------
4 # Remmina - The GTK+ Remote Desktop Client
5 # Copyright (C) 2016-2020 Antenore Gatta, Giovanni Panozzo
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
13 SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
14 REMMINATOP="$(dirname "$SCRIPTPATH")"
17 #===============================================================================
18 # FUNCTION DEFINITIONS
19 #===============================================================================
22 if [[ -n ${!1:-} ]]; then
27 } # ---------- end of function rem_varhasvalue ----------
30 typeset -p ${1:-} >/dev/null 2>&1 # Not portable, bash specific
31 } # ---------- end of function rem_varisdefined ----------
34 local _cmnhead="${HOSTNAME:=$(hostname)}"
61 # We can add color support adding colors in the beginning
64 # _reset=${RESET:-'\033[0m'}
76 if ! rem_varisdefined DFORMAT ; then
77 local _dateformat='%d/%m/%y %H:%M:%S'
79 local _dateformat=${DFORMAT:-}
81 _msgdate="$(date +"$_dateformat")"
83 # printf "%s%s - [%s] - %s - %s%s\n" "$_color" "$_header" "$_msgdate" "${_cmnhead}" "$_message" "$_reset"
84 printf "%s - [%s] - %s - %s\n" "$_header" "$_msgdate" "${_cmnhead}" "$_message"
86 } # ---------- end of function rem_log ----------
87 #-------------------------------------------------------------------------------
88 # rem_which a poorman which function
89 # Return 0 un success or 1 in case of failure
93 for _tool in "$@" ; do
94 if type "$_tool" >/dev/null 2>&1 ; then
101 rem_log INFO "$_tool found"
104 rem_log ERROR "$_tool not found"
110 } # ---------- end of function rem_which ----------
112 if ! rem_which "xgettext" "msgmerge" "git" "diff" ; then
113 rem_log ERROR "Some tools have not been found"
117 cd "$REMMINATOP" || exit 1
119 GIT_TAG="$(git describe --abbrev=0 )"
120 rem_log INFO "GIT_TAG is set to $GIT_TAG"
122 if ! rem_varhasvalue GIT_TAG ; then
123 rem_log ERROR "GIT_TAG is either empty or not set. Probably you are not in a git repository"
128 if ! find src plugins -name "*\.c" -o -name "*\.h" | sed 's/^.\///' >| po/POTFILES.in ; then
131 if ! find data -name "*.glade" | sed 's/^.\///' >> po/POTFILES.in ; then
135 xgettext --from-code=UTF-8 \
138 --keyword=translatable \
141 --keyword=g_dngettext:2,3 \
142 --add-comments=TRANSLATORS: \
143 --files-from=po/POTFILES.in \
144 --output=po/remmina.temp.pot \
145 --package-version="$GIT_TAG" \
146 --package-name="Remmina" \
147 --msgid-bugs-address="l10n@lists.remmina.org"
149 cd "$REMMINATOP"/po || exit 1
151 # Set charset to UTF-8
152 sed -i -e 's/charset=CHARSET/charset=UTF-8/g' remmina.temp.pot
154 if diff -qI "POT-Creation-Date" remmina.temp.pot remmina.pot ; then
155 rem_log INFO "No new strings to be translated"
160 mv remmina.temp.pot remmina.pot
163 # msgmerge --backup=off --update "$i" remmina.pot
166 #for i in "$REMMINATOP"/po/*.po ; do
168 # sed '/^#~/d' "$i" > "$TMPF"
169 # awk 'BEGIN{bl=0}/^$/{bl++;if(bl==1)print;else next}/^..*$/{bl=0;print}' $TMPF >| "$i"