File indexing completed on 2024-05-05 05:14:12

0001 #!/usr/bin/env bash
0002 # SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org>
0003 # SPDX-License-Identifier: CC0-1.0
0004 
0005 # The name of catalog we create (without the.pot extension)
0006 # Required by scripty
0007 FILENAME="kde-itinerary-android"
0008 
0009 # relative path to the Android resource folder
0010 ANDROID_RES_DIR="src/app/android/res"
0011 
0012 # Called by scripty for message extraction
0013 # First parameter will be the path of the pot file we have to create, includes $FILENAME
0014 function export_pot_file
0015 {
0016     mkdir outdir
0017     ANSI_COLORS_DISABLED=1 a2po export --android $ANDROID_RES_DIR --gettext outdir
0018     mv outdir/template.pot $1
0019     rm -rf outdir
0020     rm -f rc.cpp
0021 }
0022 
0023 # Called by scripty for merging messages
0024 # First parameter will be a path that will contain several .po files with the format LANG.po
0025 function import_po_files
0026 {
0027     podir=$1
0028     # Android doesn't support languages with an @
0029     find "$podir" -type f -name "*@*.po" -delete
0030     # drop obsolete messages, as Babel cannot parse them -- see:
0031     # https://github.com/python-babel/babel/issues/206
0032     # https://github.com/python-babel/babel/issues/566
0033     find "$podir" -name '*.po' -exec msgattrib --no-obsolete -o {} {} \;
0034     ANSI_COLORS_DISABLED=1 a2po import --ignore-fuzzy --android $ANDROID_RES_DIR --gettext $podir
0035 }