diff options
author | Matias Linares <matias.linares@comprandoengrupo.net> | 2024-10-31 09:51:24 -0300 |
---|---|---|
committer | Matias Linares <matias.linares@comprandoengrupo.net> | 2024-10-31 09:52:04 -0300 |
commit | c2c0192561bc50c4c774e42642074e11bee1b1b6 (patch) | |
tree | 1412a59f2966aa4125c9022c12596904f8bd7c89 | |
parent | 10d04e65085712fe9206c08ac9600109a4bcfc8e (diff) | |
download | kodereviewer-c2c0192561bc50c4c774e42642074e11bee1b1b6.tar.gz |
Add translations
-rw-r--r-- | Messages.sh | 23 | ||||
-rw-r--r-- | justfile | 11 | ||||
-rw-r--r-- | kodereviewer/app.py | 5 | ||||
-rw-r--r-- | kodereviewer/qml/ReviewDialog.qml | 6 | ||||
-rw-r--r-- | kodereviewer/qml/WelcomePage.qml | 8 | ||||
-rw-r--r-- | po/es.po | 80 | ||||
-rw-r--r-- | po/infiles.list | 19 | ||||
-rw-r--r-- | po/merge.sh | 27 | ||||
-rw-r--r-- | po/template.po | 79 | ||||
-rw-r--r-- | pyproject.toml | 12 |
10 files changed, 264 insertions, 6 deletions
diff --git a/Messages.sh b/Messages.sh new file mode 100644 index 0000000..360a3d9 --- /dev/null +++ b/Messages.sh @@ -0,0 +1,23 @@ +#! /usr/bin/env bash +DIR=`cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd` +packageRoot="kodereviewer" +echo "[merge] Extracting messages" +packageName="org.deprecated.kodereviewer" +find "${packageRoot}" -name '*.py' -name '*.cpp' -o -name '*.h' -o -name '*.c' -o -name '*.qml' -o -name '*.js' | sort > "${DIR}/infiles.list" + +xgettext \ + --files-from=infiles.list \ + --from-code=UTF-8 \ + --width=400 \ + --add-location=file \ + -C -kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 -kI18N_NOOP:1 \ + -kI18N_NOOP2:1c,2 -kN_:1 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \ + --package-name="${widgetName}" \ + -D "${packageRoot}" \ + -D "${DIR}" \ + -o "po/template.po" \ + || \ + { echo "[merge] error while calling xgettext. aborting."; exit 1; } + #--msgid-bugs-address="${bugAddress}" \ + +rm "${DIR}/infiles.list" @@ -1,7 +1,16 @@ run: python -mkodereviewer -build-python: +copy-assets: + mkdir -p share/locales/es/LC_MESSAGES/ + mkdir -p share/applications/ + mkdir -p share/icons/hicolor/scalable/apps/ + + cp po/es.mo share/locales/es/LC_MESSAGES/ + cp org.deprecated.kodereviewer.svg share/icons/hicolor/scalable/apps/ + cp org.deprecated.kodereviewer.desktop share/applications + +build-python: copy-assets python -mbuild build-flatpak: diff --git a/kodereviewer/app.py b/kodereviewer/app.py index eb196d1..bb1080f 100644 --- a/kodereviewer/app.py +++ b/kodereviewer/app.py @@ -3,6 +3,7 @@ import os import sys import signal +import gettext from KI18n import KLocalizedContext, KLocalizedString from PySide6.QtGui import QGuiApplication @@ -25,14 +26,18 @@ logging.basicConfig( level="INFO", format=FORMAT, datefmt="[%X]", handlers=[RichHandler()] ) +logger = logging.getLogger(__name__) + def main(): """Initializes and manages the application execution""" app = QGuiApplication(sys.argv) engine = QQmlApplicationEngine() # KLocalizedString::setApplicationDomain("tutorial"); + KLocalizedString.setApplicationDomain(QByteArray(b"kodereviewer")) + app.setOrganizationName("Deprecated") app.setOrganizationDomain("deprecated.org") app.setApplicationName("Kode Reviewer") diff --git a/kodereviewer/qml/ReviewDialog.qml b/kodereviewer/qml/ReviewDialog.qml index 7dcaf9c..9965673 100644 --- a/kodereviewer/qml/ReviewDialog.qml +++ b/kodereviewer/qml/ReviewDialog.qml @@ -51,6 +51,10 @@ Kirigami.Dialog { } function requiredFieldsFilled() { + // Approve doesn't need a message. + if (event == 'APPROVE') { + return true + } return event != '' && reviewBodyText != '' } @@ -58,7 +62,7 @@ Kirigami.Dialog { reviewBodyText = '' approveRadioButton.checked = false commentRadioButton.checked = false - requestChangesRadioButton = false + requestChangesRadioButton.checked = false event = '' } diff --git a/kodereviewer/qml/WelcomePage.qml b/kodereviewer/qml/WelcomePage.qml index af74d01..90952b9 100644 --- a/kodereviewer/qml/WelcomePage.qml +++ b/kodereviewer/qml/WelcomePage.qml @@ -67,7 +67,7 @@ FormCard.FormCardPage { Kirigami.Heading { id: welcomeMessage - text: "Welcome to Kode Reviewer" + text: i18n("Welcome to Kode Reviewer") Layout.alignment: Qt.AlignHCenter Layout.topMargin: Kirigami.Units.largeSpacing @@ -97,19 +97,19 @@ FormCard.FormCardPage { } FormCard.FormHeader { - title: "Add new project" + title: i18n("Add new project") } FormCard.FormCard { FormCard.FormButtonDelegate { - text: "Add new project" + text: i18n("Add new project") onClicked: applicationWindow().pageStack.push(addRepositoryPage) } } FormCard.FormCard { FormCard.FormButtonDelegate { - text: "Settings" + text: i18n("Settings") icon.name: 'settings-configure-symbolic' onClicked: configuration.open() } diff --git a/po/es.po b/po/es.po new file mode 100644 index 0000000..bccdac9 --- /dev/null +++ b/po/es.po @@ -0,0 +1,80 @@ +# Translation of in es +# Copyright (C) 2024 +# This file is distributed under the same license as the package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-31 09:24-0300\n" +"PO-Revision-Date: 2024-10-31 09:26-0300\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: Poedit 3.4.2\n" + +#: kodereviewer/qml/Main.qml +msgid "Info" +msgstr "Info" + +#: kodereviewer/qml/Main.qml +msgid "Comments" +msgstr "Comentarios" + +#: kodereviewer/qml/Main.qml +msgid "Files" +msgstr "Archivos" + +#: kodereviewer/qml/Main.qml +msgid "Reviews" +msgstr "Revisiones" + +#: kodereviewer/qml/PullRequestDescription.qml +msgid "Yes" +msgstr "Si" + +#: kodereviewer/qml/PullRequestDescription.qml +msgid "No" +msgstr "No" + +#: kodereviewer/qml/ReviewDialog.qml +msgctxt "@title:window" +msgid "Review changes" +msgstr "Revisar cambios" + +#: kodereviewer/qml/WelcomePage.qml +msgctxt "@action:button" +msgid "General" +msgstr "General" + +#: kodereviewer/qml/WelcomePage.qml +msgctxt "@action:button" +msgid "About Kode Reviewer" +msgstr "Acerca Kode Reviewer" + +#: kodereviewer/qml/WelcomePage.qml +msgctxt "@title:group" +msgid "About" +msgstr "Acerca" + +#: kodereviewer/qml/WelcomePage.qml +msgctxt "@action:button" +msgid "About KDE" +msgstr "Acerca KDE" + +#: kodereviewer/qml/WelcomePage.qml +msgid "Welcome to Kode Reviewer" +msgstr "Bienvenido a Kode Reviewer" + +#: kodereviewer/qml/WelcomePage.qml +msgid "Add new project" +msgstr "Agregar nuevo projecto" + +#: kodereviewer/qml/WelcomePage.qml +msgid "Settings" +msgstr "ConfiguraciĆ³n" diff --git a/po/infiles.list b/po/infiles.list new file mode 100644 index 0000000..6a0d0da --- /dev/null +++ b/po/infiles.list @@ -0,0 +1,19 @@ +kodereviewer/qml/AddRepositoryPage.qml +kodereviewer/qml/CommentDelegate.qml +kodereviewer/qml/CommentPage.qml +kodereviewer/qml/Editor.qml +kodereviewer/qml/FilesChangedPage.qml +kodereviewer/qml/FilesDrawer.qml +kodereviewer/qml/FilesView.qml +kodereviewer/qml/Main.qml +kodereviewer/qml/MarkdownLabel.qml +kodereviewer/qml/MarkdownTextArea.qml +kodereviewer/qml/ProjectListPage.qml +kodereviewer/qml/PullRequestDescriptionPage.qml +kodereviewer/qml/PullRequestDescription.qml +kodereviewer/qml/PullRequestFilesDrawer.qml +kodereviewer/qml/ReviewDialog.qml +kodereviewer/qml/ReviewListPage.qml +kodereviewer/qml/ReviewList.qml +kodereviewer/qml/SettingsPage.qml +kodereviewer/qml/WelcomePage.qml diff --git a/po/merge.sh b/po/merge.sh new file mode 100644 index 0000000..68dc352 --- /dev/null +++ b/po/merge.sh @@ -0,0 +1,27 @@ +#/bin/bash +DIR=`cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd` +packageRoot="kodereviewer" +echo "[merge] Extracting messages" +packageName="org.deprecated.kodereviewer" +find "${packageRoot}" -name '*.py' -name '*.cpp' -o -name '*.h' -o -name '*.c' -o -name '*.qml' -o -name '*.js' | sort > "${DIR}/infiles.list" + + +echo "[merge] Merging messages" +catalogs=`find . -name '*.po' | sort` +for cat in $catalogs; do + echo "[merge] $cat" + catLocale=`basename ${cat%.*}` + msgmerge \ + --width=400 \ + --add-location=file \ + --no-fuzzy-matching \ + -o "$cat.new" \ + "$cat" "${DIR}/template.po" + sed -i 's/# SOME DESCRIPTIVE TITLE./'"# Translation of ${widgetName} in ${catLocale}"'/' "$cat.new" + sed -i 's/# Translation of '"${widgetName}"' in LANGUAGE/'"# Translation of ${widgetName} in ${catLocale}"'/' "$cat.new" + sed -i 's/# Copyright (C) YEAR THE PACKAGE'"'"'S COPYRIGHT HOLDER/'"# Copyright (C) $(date +%Y)"'/' "$cat.new" + + mv "$cat.new" "$cat" +done + +echo "[merge] Done merging messages" diff --git a/po/template.po b/po/template.po new file mode 100644 index 0000000..71d0d46 --- /dev/null +++ b/po/template.po @@ -0,0 +1,79 @@ +# Translation of in template +# Copyright (C) 2024 +# This file is distributed under the same license as the package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-10-31 09:24-0300\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" +"Language-Team: LANGUAGE <LL@li.org>\n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: kodereviewer/qml/Main.qml +msgid "Info" +msgstr "" + +#: kodereviewer/qml/Main.qml +msgid "Comments" +msgstr "" + +#: kodereviewer/qml/Main.qml +msgid "Files" +msgstr "" + +#: kodereviewer/qml/Main.qml +msgid "Reviews" +msgstr "" + +#: kodereviewer/qml/PullRequestDescription.qml +msgid "Yes" +msgstr "" + +#: kodereviewer/qml/PullRequestDescription.qml +msgid "No" +msgstr "" + +#: kodereviewer/qml/ReviewDialog.qml +msgctxt "@title:window" +msgid "Review changes" +msgstr "" + +#: kodereviewer/qml/WelcomePage.qml +msgctxt "@action:button" +msgid "General" +msgstr "" + +#: kodereviewer/qml/WelcomePage.qml +msgctxt "@action:button" +msgid "About Kode Reviewer" +msgstr "" + +#: kodereviewer/qml/WelcomePage.qml +msgctxt "@title:group" +msgid "About" +msgstr "" + +#: kodereviewer/qml/WelcomePage.qml +msgctxt "@action:button" +msgid "About KDE" +msgstr "" + +#: kodereviewer/qml/WelcomePage.qml +msgid "Welcome to Kode Reviewer" +msgstr "" + +#: kodereviewer/qml/WelcomePage.qml +msgid "Add new project" +msgstr "" + +#: kodereviewer/qml/WelcomePage.qml +msgid "Settings" +msgstr "" diff --git a/pyproject.toml b/pyproject.toml index 9f8a0d3..657ab63 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,9 +22,21 @@ build-backend = "hatchling.build" [tool.hatch.build.targets.wheel] packages = ["kodereviewer/"] +[tool.hatch.build.targets.sdist] +include = [ + 'kodereviewer/', + 'share/' +] +exclude = [ + '.jj/' +] + + + [options.data_files] "share/applications" = "org.deprecated.kodereviewer.desktop" "share/icons/hicolor/scalable/apps" = "org.deprecated.kodereviewer.svg" +"share/locales/es/LC_MESSAGES/" = "po/es.mo" [project.scripts] kodereviewer = "kodereviewer.app:main" |