[graphics/krita] /: [android] Allow translating string resources
Dmitry Kazakov <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 6fc87cf5b56ea6807bec0d4413a93e66b5465287 by Dmitry Kazakov, on behalf of Carsten Hartenfels. Committed on 07/08/2026 at 12:18. Pushed by dkazakov into branch 'master'. [android] Allow translating string resources By adding a StaticMessages.sh file. This is taken from KDE Itinerary, only the catalog name and resource path have been changed. See https://www.volkerkrause.eu/2021/12/18/kde-android-translation-integration.html and https://invent.kde.org/pim/itinerary/-/blob/master/StaticMessages.sh BUG:523734 A +35 -0 StaticMessages.sh https://invent.kde.org/graphics/krita/-/commit/6fc87cf5b56ea6807bec0d4413a93e66b5465287 diff --git a/StaticMessages.sh b/StaticMessages.sh new file mode 100644 index 00000000000..089ff3f4906 --- /dev/null +++ b/StaticMessages.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# SPDX-FileCopyrightText: 2021 Volker Krause <[email protected]> +# SPDX-License-Identifier: CC0-1.0 + +# The name of catalog we create (without the.pot extension) +# Required by scripty +FILENAME="krita-android" + +# relative path to the Android resource folder +ANDROID_RES_DIR="packaging/android/apk/res" + +# Called by scripty for message extraction +# First parameter will be the path of the pot file we have to create, includes $FILENAME +function export_pot_file +{ + mkdir outdir + ANSI_COLORS_DISABLED=1 a2po export --android $ANDROID_RES_DIR --gettext outdir + mv outdir/template.pot $1 + rm -rf outdir + rm -f rc.cpp +} + +# Called by scripty for merging messages +# First parameter will be a path that will contain several .po files with the format LANG.po +function import_po_files +{ + podir=$1 + # Android doesn't support languages with an @ + find "$podir" -type f -name "*@*.po" -delete + # drop obsolete messages, as Babel cannot parse them -- see: + # https://github.com/python-babel/babel/issues/206 + # https://github.com/python-babel/babel/issues/566 + find "$podir" -name '*.po' -exec msgattrib --no-obsolete -o {} {} \; + ANSI_COLORS_DISABLED=1 a2po import --ignore-fuzzy --android $ANDROID_RES_DIR --gettext $podir +}