Math Processor Unit Library

libmpu – library of arithmetic functions for integer, real, and complex numbers of increased digit capacity

16 Commits   0 Branches   2 Tags
author: kx <kx@radix-linux.su> 2024-12-20 16:11:07 +0300 committer: kx <kx@radix-linux.su> 2024-12-20 16:11:07 +0300 commit: 868b2b66b564b5c00e3a74d10be45db7151627ac parent: cce2ae8d3312493b7653358bb4af201d3271377b
Commit Summary:
Version 1.0.14
Diffstat:
1 file changed, 45 insertions, 0 deletions
diff --git a/l10n/gen-pot-file b/l10n/gen-pot-file
new file mode 100755
index 0000000..ad465c8
--- /dev/null
+++ b/l10n/gen-pot-file
@@ -0,0 +1,57 @@
+#!/bin/bash
+
+CWD=`pwd`
+
+SCRIPT_DIR=`cd $(dirname ${BASH_SOURCE[0]}) >/dev/null 2>&1 && pwd`
+program=`basename $0`
+
+save_new_version() {
+  local ifile=${1}
+  local ofile=${2}
+  local iline=`cat ${ifile} | grep 'Project-Id-Version:'`
+  local version=`echo ${iline} | cut -f2 -d':' | tr -s ' ' | sed 's,^[ \t]*,,' | sed 's,[ \t]*$,,' | sed 's,[\]n["]$,,'`
+
+  local oline=`cat ${ofile} | grep -n 'Project-Id-Version:' | cut -f2,3 -d':'`
+  local olnum=`cat ${ofile} | grep -n 'Project-Id-Version:' | cut -f1 -d':'`
+
+  if [ ! -z "${oline}" -a -z "`echo ${oline} | grep "${version}"`" ] ; then
+    echo "$ifile: Keep new 'Project-Id-Version: ${version}'"
+       sed -i "${olnum} c\
+\"Project-Id-Version: ${version}\\\n\"" ${ofile}
+  fi
+}
+
+cd ${SCRIPT_DIR}/..
+
+PACKAGE_VERSION=`cat configure.ac | grep AC_INIT | sed 's,.*\[\([.0-9]*\)\].*,\1,'`
+
+POTFILE=po/libmpu.pot
+
+if [ -f "$POTFILE" ] ; then
+  cp -a ${POTFILE} ${POTFILE}~
+fi
+
+xgettext --from-code=UTF-8 --keyword=N_ --keyword=_ --keyword=Q_:1,2  \
+         --language=C --add-comments --sort-output --no-wrap \
+         --msgid-bugs-address="Andrey V.Kosteltsev <support@radix-linux.su>" \
+         --package-name=libmpu \
+         --package-version=${PACKAGE_VERSION} \
+         --copyright-holder="Andrey V.Kosteltsev <kx@radix-linux.su>" \
+         --default-domain=libmpu --output=${POTFILE} \
+         `find -type f -name "*.c"`
+
+( cd po ;
+  _LOCALE=ru_RU.utf8
+  _PO_FNAME=ru
+  mv ${_PO_FNAME}.po ${_PO_FNAME}.po~
+  echo -en "Create new ${_PO_FNAME}.po file:\n.. "
+  msginit --no-translator --no-wrap --locale=${_LOCALE} --input=libmpu.pot --output-file=${_PO_FNAME}.po
+  echo "Merge translated strings back ${_PO_FNAME}.po:"
+  msgmerge --no-wrap --sort-output ${_PO_FNAME}.po~ ${_PO_FNAME}.po > ${_PO_FNAME}.po.new
+  # ======= Save new version: =======
+  save_new_version ${_PO_FNAME}.po ${_PO_FNAME}.po.new
+  mv ${_PO_FNAME}.po.new ${_PO_FNAME}.po
+#  rm -f ${_PO_FNAME}.po~
+)
+
+cd l10n