From 7eb210edd3cde4c680ce0053fc09c7813a43b655 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 25 Jul 2023 16:04:24 +0800 Subject: [PATCH] Block wrongly used words in Chinese translation --- ....18.1-find_lang-detect-Chinese-typos.patch | 33 +++++++++++++++++++ rpm.spec | 8 ++++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 rpm-4.18.1-find_lang-detect-Chinese-typos.patch diff --git a/rpm-4.18.1-find_lang-detect-Chinese-typos.patch b/rpm-4.18.1-find_lang-detect-Chinese-typos.patch new file mode 100644 index 0000000..93e9b2d --- /dev/null +++ b/rpm-4.18.1-find_lang-detect-Chinese-typos.patch @@ -0,0 +1,33 @@ +--- rpm-4.18.1/scripts/find-lang.sh.orig 2023-07-24 00:05:17.801271891 +0800 ++++ rpm-4.18.1/scripts/find-lang.sh 2023-07-24 00:26:59.888943142 +0800 +@@ -281,4 +281,29 @@ + echo "No translations found for ${NAME} in ${TOP_DIR}" + exit 1 + fi +-exit 0 ++ ++# Deal with wrongly used typo in Chinese translation ++typos=("帐户" "帐号") ++have_typo=0 ++ ++for typo in ${typos[@]} ++do ++ # Search .mo translation files ++ for mo_file in `cat $MO_NAME |grep '%lang(zh) .*mo$'|awk '{ print $2 }'` ++ do ++ if msgunfmt --no-wrap $TOP_DIR/$mo_file | grep -q "$typo" ; then ++ have_typo=1 ++ echo "Typo $typo found in $mo_file" ++ fi ++ done ++ ++ # Search application files ++ for desktop_file in `find $TOP_DIR/usr/share/applications/ -name *.desktop | awk -F"$TOP_DIR" '{ print $2 } '` ++ do ++ if grep -q "$typo" $TOP_DIR$desktop_file ; then ++ have_typo=1 ++ echo "Typo $typo found in $desktop_file" ++ fi ++ done ++done ++exit $have_typo diff --git a/rpm.spec b/rpm.spec index 27ed953..976d5a6 100644 --- a/rpm.spec +++ b/rpm.spec @@ -1,4 +1,4 @@ -%define anolis_release 1 +%define anolis_release 2 %define rpmhome /usr/lib/rpm %bcond_with check %bcond_without xz @@ -34,6 +34,9 @@ Patch0: rpm-4.17.x-rpm_dbpath.patch Patch1: rpm-4.18.x-ldflags.patch # Allow install docs when building without pandoc Patch2: rpm-4.18.x-revert-pandoc-cond.patch + +# Block wrongly used words in Chinese translation +Patch101: rpm-4.18.1-find_lang-detect-Chinese-typos.patch License: GPLv2+ BuildRequires: automake libtool system-rpm-config systemd-rpm-macros make gawk @@ -592,6 +595,9 @@ fi %doc docs/librpm/html/* %changelog +* Mon Jul 24 2023 Funda Wang - 4.18.1-2 +- Block wrongly used words in Chinese translation + * Wed Jul 12 2023 Funda Wang - 4.18.1-1 - New version 4.18.1 -- Gitee