]> gitweb.stoutner.com Git - PrivacyBrowserPC.git/blobdiff - update_po_template
At the PO template (translation) framework.
[PrivacyBrowserPC.git] / update_po_template
diff --git a/update_po_template b/update_po_template
new file mode 100755 (executable)
index 0000000..38aa12c
--- /dev/null
@@ -0,0 +1,32 @@
+#! /usr/bin/env bash
+
+# Copyright © 2022 Soren Stoutner <soren@stoutner.com>.
+#
+# This file is part of Privacy Browser PC <https://www.stoutner.com/privacy-browser-pc>.
+#
+# Privacy Browser PC is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Privacy Browser PC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Privacy Browser PC.  If not, see <http://www.gnu.org/licenses/>.
+
+
+# Extract the strings from the UI and RC files and add them to a temporary .app file.
+extractrc `find -name \*.ui -o -name \*.rc -o -name \*.kcfg` >> rc.cpp
+
+# Add the names of the translators.
+echo 'i18nc("NAME OF TRANSLATORS", "Your names");' >> rc.cpp
+echo 'i18nc("EMAIL OF TRANSLATORS", "Your emails");' >> rc.cpp
+
+# Extract all the string to a PO template file.
+xgettext --c++ --kde --from-code=UTF-8 -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 -kkli18n:1 -kkli18nc:1c,2 -kkli18np:1,2 -kkli18ncp:1c,2,3 -kI18N_NOOP:1 -kI18NC_NOOP:1c,2 `find . -name \*.cpp` -o po/privacybrowser.pot
+
+# Remove the temporary .app file.
+rm -f rc.cpp