• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# Copyright (C) 2001 Free Software Foundation, Inc.
4# Written by Bruno Haible <bruno@clisp.org>, 2001.
5#
6# This program is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program.  If not, see <https://www.gnu.org/licenses/>.
18
19# Print the team's address (to stdout) and output additional instructions
20# (to stderr).
21
22projectsdir="$1"
23progdir="$2"
24catalog="$3"  # e.g. "pt_BR"
25language="$4" # e.g. "pt"
26
27url=`cat "$projectsdir/KDE/teams.url"`
28html=`"$progdir/urlget" "$url" "$projectsdir/KDE/teams.html"`
29# The HTML page says they are "presently switching from the 2-letter codes
30# to the 3-letter codes". So it is safest to use the English name and
31# translate ourselves...
32case "$catalog" in
33  af) english=Afrikaans;;
34  ar) english=Arabic;;
35  az) english=Azerbaijani;;
36  bg) english=Bulgarian;;
37  bn) english=Bengali;;
38  bo) english=Tibetan;;
39  br) english=Breton;;
40  bs) english=Bosnian;;
41  ca) english=Catalan;;
42  cs) english=Czech;;
43  cy) english=Welsh;;
44  da) english=Danish;;
45  de) english=German;;
46  el) english=Greek;;
47  en_GB) english="British English";;
48  eo) english=Esperanto;;
49  es) english=Spanish;;
50  et) english=Estonian;;
51  eu) english=Basque;;
52  fa) english=Farsi;;
53  fi) english=Finnish;;
54  fo) english=Faroese;;
55  fr) english=French;;
56  ga) english=Irish;;
57  gl) english=Gallegan;;
58  gu) english=Gujarati;;
59  he) english=Hebrew;;
60  hi) english=Hindi;;
61  hr) english=Croatian;;
62  hu) english=Hungarian;;
63  id) english=Indonesian;;
64  is) english=Icelandic;;
65  it) english=Italian;;
66  ja) english=Japanese;;
67  km) english=Khmer;;
68  ko) english=Korean;;
69  ku) english=Kurdish;;
70  lt) english=Lithuanian;;
71  lv) english=Latvian;;
72  mi) english=Maori;;
73  mk) english=Macedonian;;
74  mr) english=Marathi;;
75  mt) english=Maltese;;
76  nl) english=Dutch;;
77  no) english="Norwegian (Bokm";;
78  nn) english="Norwegian (Nynorsk)";;
79  oc) english=Occitan;;
80  pl) english=Polish;;
81  pt) english=Portuguese;;
82  pt_BR) english="Brazilian Portuguese";;
83  ro) english=Romanian;;
84  ru) english=Russian;;
85  sk) english=Slovak;;
86  sl) english=Slovenian;;
87  sr) english=Serbian;;
88  sv) english=Swedish;;
89  ta) english=Tamil;;
90  tg) english=Tajik;;
91  th) english=Thai;;
92  tr) english=Turkish;;
93  uk) english=Ukrainian;;
94  vi) english=Vietnamese;;
95  # ??) english=Walloon;;
96  xh) english=Xhosa;;
97  zh_CN) english="Simplified Chinese";;
98  zh_TW) english="Traditional Chinese";;
99  *) english=;;
100esac
101if test -n "$english"; then
102  (echo "Please consider joining your translation team, and visit"
103   sed_addnl='s,</TR>,</TR>\
104,g'
105   anchor=`echo "$html" | tr '\012' '|' | sed -e "$sed_addnl" | sed -n -e 's,^.*<TR.*<A NAME="\([^"]*\)">.*>'"$english"'[^<>]*team<.*</TR>$,\1,p'`
106   if test -n "$anchor"; then
107     echo "  $url#$anchor"
108   fi
109   echo "  $url"
110   echo "  https://l10n.kde.org/"
111  ) 1>&2
112  address1=`echo "$html" | tr '\012' '|' | sed -n -e 's,^.*>'"$english"'[^<>]*team<\(.*\)$,\1,p' | sed -e "$sed_addnl" | sed -e 2q -e 1d | sed -n -e 's,^.*mailing list\(.*\)$,\1,p' | sed -e 's,</LI>.*,,' | sed -e 's,</A>.*,</A>,' | sed -n -e 's,^.*HREF="\([^"]*\)">[^<>]*</A>.*$,\1,p'`
113  case "$address1" in
114    mailto:*) address1=`echo "$address1" | sed -e 's,^mailto:,<,' -e 's,$,>,'` ;;
115  esac
116  address1=`echo "$address1" | sed -e 's,-request@,@,'`
117  address2=`echo "$html" | tr '\012' '|' | sed -n -e 's,^.*>'"$english"'[^<>]*team<\(.*\)$,\1,p' | sed -e "$sed_addnl" | sed -e 2q -e 1d | sed -n -e 's,^.*web site\(.*\)$,\1,p' | sed -e 's,</LI>.*,,' | sed -e 's,</A>.*,</A>,' | sed -n -e 's,^.*HREF="\([^"]*\)">[^<>]*</A>.*$,\1,p'`
118  if test -n "$address1" && test -n "$address2"; then
119    address="$address1 $address2"
120  else
121    address="$address1$address2"
122  fi
123  # address can be empty or contain 1 or more space separated URLs.
124else
125  (echo "A translation team for your "`if test "$catalog" = "$language"; then echo "language ($language)"; else echo "local dialect ($catalog)"; fi`
126   echo "may not exist yet.  Please visit"
127   echo "  $url"
128   echo "  https://l10n.kde.org/"
129   echo "and decide whether you want to create a new translation team."
130  ) 1>&2
131  address=
132fi
133exit 0
134