Remmina - The GTK+ Remote Desktop Client  v1.4.33
Remmina is a remote desktop client written in GTK+, aiming to be useful for system administrators and travellers, who need to work with lots of remote computers in front of either large monitors or tiny netbooks. Remmina supports multiple network protocols in an integrated and consistent user interface. Currently RDP, VNC, NX, XDMCP and SSH are supported.
update-translations.sh
Go to the documentation of this file.
1 #!/bin/bash -
2 
3 # --------------------------------------------------------------------------
4 # Remmina - The GTK+ Remote Desktop Client
5 # Copyright (C) 2016-2023 Antenore Gatta, Giovanni Panozzo
6 #
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.
11 #
12 
13 SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )"
14 REMMINATOP="$(dirname "$SCRIPTPATH")"
15 
16 
17 #===============================================================================
18 # FUNCTION DEFINITIONS
19 #===============================================================================
20 
21 rem_varhasvalue () {
22  if [[ -n ${!1:-} ]]; then
23  return 0
24  fi
25  return 1
26 
27 } # ---------- end of function rem_varhasvalue ----------
28 
29 rem_varisdefined () {
30  typeset -p ${1:-} >/dev/null 2>&1 # Not portable, bash specific
31 } # ---------- end of function rem_varisdefined ----------
32 
33 rem_log () {
34  local _cmnhead="${HOSTNAME:=$(hostname)}"
35  local _header=""
36  local _message="$*"
37  #local _stdout=""
38  local _msgdate=""
39  case "$1" in
40  CRITICAL)
41  _header="CRITICAL"
42  shift
43  _message="$*"
44  ;;
45  ERROR)
46  _header="ERROR"
47  shift
48  _message="$*"
49  ;;
50  WARNING)
51  _header="WARNING"
52  shift
53  _message="$*"
54  ;;
55  DEBUG)
56  _header="DEBUG"
57  shift
58  _message="$*"
59  ;;
60  INFO)
61  # We can add color support adding colors in the beginning
62  # GREEN="\033[0;32m"
63  # RESET="\033[0m"
64  # _reset=${RESET:-'\033[0m'}
65  # _color=${_reset}
66  #_color=${GREEN}
67  _header="INFO"
68  shift
69  _message="$*"
70  ;;
71  *)
72  _header="INFO"
73  _message="$*"
74  ;;
75  esac
76  if ! rem_varisdefined DFORMAT ; then
77  local _dateformat='%d/%m/%y %H:%M:%S'
78  else
79  local _dateformat=${DFORMAT:-}
80  fi
81  _msgdate="$(date +"$_dateformat")"
82 
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"
85 
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
90 rem_which () {
91  local _tool=()
92  local _ret=
93  for _tool in "$@" ; do
94  if type "$_tool" >/dev/null 2>&1 ; then
95  _ret=0
96  else
97  _ret=1
98  fi
99  case $_ret in
100  0)
101  rem_log INFO "$_tool found"
102  ;;
103  83)
104  rem_log ERROR "$_tool not found"
105  ;;
106  esac
107  done
108  unset _tool
109  return "$_ret"
110 } # ---------- end of function rem_which ----------
111 
112 if ! rem_which "xgettext" "msgmerge" "git" "diff" ; then
113  rem_log ERROR "Some tools have not been found"
114  exit 1
115 fi
116 
117 cd "$REMMINATOP" || exit 1
118 
119 GIT_TAG="$(git describe --abbrev=0 )"
120 rem_log INFO "GIT_TAG is set to $GIT_TAG"
121 
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"
124  exit 1
125 fi
126 
127 
128 if ! find src plugins -name "*\.c" -o -name "*\.h" | sed 's/^.\///' >| po/POTFILES.in ; then
129  exit 1
130 fi
131 if ! find data -name "*.glade" | sed 's/^.\///' >> po/POTFILES.in ; then
132  exit 1
133 fi
134 
135 xgettext --from-code=UTF-8 \
136  --keyword=_ \
137  --keyword=N_ \
138  --keyword=translatable \
139  --keyword=C_:1c,2 \
140  --keyword=NC_:1c,2 \
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"
148 
149 cd "$REMMINATOP"/po || exit 1
150 
151 # Set charset to UTF-8
152 sed -i -e 's/charset=CHARSET/charset=UTF-8/g' remmina.temp.pot
153 
154 if diff -qI "POT-Creation-Date" remmina.temp.pot remmina.pot ; then
155  rem_log INFO "No new strings to be translated"
156  rm remmina.temp.pot
157  exit 0
158 fi
159 
160 mv remmina.temp.pot remmina.pot
161 
162 #for i in *.po; do
163 # msgmerge --backup=off --update "$i" remmina.pot
164 #done
165 #
166 #for i in "$REMMINATOP"/po/*.po ; do
167 # TMPF=/tmp/f$$.txt
168 # sed '/^#~/d' "$i" > "$TMPF"
169 # awk 'BEGIN{bl=0}/^$/{bl++;if(bl==1)print;else next}/^..*$/{bl=0;print}' $TMPF >| "$i"
170 # rm $TMPF
171 #done