maint: remove dead hint files
[midnight-commander.git] / maint / utils / sync-transifex / po-fromTransifex.sh
blob21effdf0bdb98f8135915aeb669da78907cf6285
1 #!/bin/bash
3 # Midnight Commander - fetch doc/hints/mc.hint translations from Transifex
5 # Copyright (C) 2013
6 # The Free Software Foundation, Inc.
8 # Written by:
9 # Slava Zanko <slavazanko@gmail.com>, 2013
11 # This file is part of the Midnight Commander.
13 # The Midnight Commander is free software: you can redistribute it
14 # and/or modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation, either version 3 of the License,
16 # or (at your option) any later version.
18 # The Midnight Commander is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
23 # You should have received a copy of the GNU General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
26 set -e
28 MC_SOURCE_ROOT_DIR=${MC_SOURCE_ROOT_DIR:-$(dirname $(dirname $(dirname $(pwd))))}
30 #*** include section (source functions, for example) *******************
32 source "${MC_SOURCE_ROOT_DIR}/maint/utils/sync-transifex/functions"
34 #*** file scope functions **********************************************
36 stripLocation() {
37 work_dir=$1; shift
39 for i in $(find "${work_dir}" -name '*.po' -print); do
40 sed -i '/^#:/d' "${i}"
41 done
44 # ----------------------------------------------------------------------
46 copyFilesToSourceDir() {
47 work_dir=$1; shift
48 source_dir=$1; shift
50 exclude_list_file=$(getConfigFile "po" "po-ignore.list")
52 for i in $(find "${work_dir}" -name '*.po' -print | sort); do
53 [ $(grep -c "^\s*$(basename ${i})" "${exclude_list_file}") -ne 1 ] && {
54 cp -f "${i}" "${source_dir}"
56 done
59 #*** main code *********************************************************
61 WORK_DIR=$(initSyncDirIfNeeded "po")
63 receiveTranslationsFromTransifex "${WORK_DIR}"
65 stripLocation "${WORK_DIR}"
67 copyFilesToSourceDir "${WORK_DIR}" "${MC_SOURCE_ROOT_DIR}/po"