From 2d103ed4546c79d7d4b5233a4bebf93809920674 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Fri, 22 Oct 2021 22:23:59 +0200 Subject: Fix the file save dialog and translations --- LICENSE | 2 +- po/cs.po | 32 +++++++++++++++++--------------- po/de.po | 23 ++++++++++++++--------- po/logdiag.pot | 22 +++++++++++++--------- po/make-template.sh | 49 +++++++++++++++++-------------------------------- po/pl.po | 23 ++++++++++++++--------- po/sk.po | 23 ++++++++++++++--------- src/ld-window-main.c | 20 +++++++++++++------- 8 files changed, 103 insertions(+), 91 deletions(-) diff --git a/LICENSE b/LICENSE index b0fc13c..7a75655 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2010 - 2018, Přemysl Eric Janouch +Copyright (c) 2010 - 2021, Přemysl Eric Janouch Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. diff --git a/po/cs.po b/po/cs.po index 1ccab81..c23dca0 100644 --- a/po/cs.po +++ b/po/cs.po @@ -6,27 +6,27 @@ msgid "" msgstr "" "Project-Id-Version: logdiag\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-27 04:52+0200\n" -"PO-Revision-Date: 2018-06-25 04:02+0200\n" +"Report-Msgid-Bugs-To: https://git.janouch.name/p/logdiag/issues\n" +"POT-Creation-Date: 2021-10-22 22:16+0200\n" +"PO-Revision-Date: 2021-10-22 22:21+0200\n" "Last-Translator: Přemysl Eric Janouch \n" "Language-Team: Czech \n" "Language: cs\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.0.8\n" +"X-Generator: Poedit 3.0\n" -#: ../src/ld-window-main.c:931 +#: ../src/ld-window-main.c:937 #, c-format msgid "%d%%" msgstr "%d %%" -#: ../src/logdiag.c:146 +#: ../src/logdiag.c:147 msgid "- Schematic editor" msgstr "- Editor schémat" -#: ../src/ld-window-main.c:855 +#: ../src/ld-window-main.c:861 msgid "Close _without Saving" msgstr "Zavřít _bez uložení" @@ -59,7 +59,7 @@ msgstr "Nelze otevřít soubor" msgid "Failed to save the diagram" msgstr "Nelze uložit diagram" -#: ../src/ld-window-main.c:853 +#: ../src/ld-window-main.c:859 msgid "If you don't save, changes will be permanently lost." msgstr "Pokud je neuložíte, budou změny navždy ztraceny." @@ -87,7 +87,7 @@ msgstr "Provede posledně vrácenou akci" msgid "Reset zoom level back to the default" msgstr "Vrátí přiblížení na výchozí hodnotu" -#: ../src/ld-window-main.c:790 +#: ../src/ld-window-main.c:792 msgid "Save As..." msgstr "Uložit jako..." @@ -97,17 +97,15 @@ msgstr "Uložit _jako..." #: ../src/ld-window-main.c:623 #, c-format -msgid "" -"Save the changes to diagram \"%s\" before closing it and creating a new one?" +msgid "Save the changes to diagram \"%s\" before closing it and creating a new one?" msgstr "Uložit změny v diagramu \"%s\" před jeho zavřením a vytvořením nového?" #: ../src/ld-window-main.c:755 #, c-format -msgid "" -"Save the changes to diagram \"%s\" before closing it and opening another one?" +msgid "Save the changes to diagram \"%s\" before closing it and opening another one?" msgstr "Uložit změny v diagramu \"%s\" před jeho zavřením a otevřením jiného?" -#: ../src/ld-window-main.c:893 +#: ../src/ld-window-main.c:899 #, c-format msgid "Save the changes to diagram \"%s\" before closing?" msgstr "Uložit změny v diagramu \"%s\" před jeho zavřením?" @@ -160,6 +158,10 @@ msgstr "Vrátí poslední akci" msgid "Unsaved Diagram" msgstr "Neuložený diagram" +#: ../src/ld-window-main.c:806 +msgid "Untitled diagram" +msgstr "Nepojmenovaný diagram" + #: ../src/ld-window-main.c:171 msgid "Zoom _Out" msgstr "_Oddálit" @@ -240,7 +242,7 @@ msgstr "_Zobrazení" msgid "_Zoom In" msgstr "_Přiblížit" -#: ../src/ld-window-main.c:977 +#: ../src/ld-window-main.c:983 msgid "translator-credits" msgstr "Přemysl Eric Janouch " diff --git a/po/de.po b/po/de.po index 06bf96f..f8c8d4e 100644 --- a/po/de.po +++ b/po/de.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: logdiag\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-27 04:52+0200\n" +"Report-Msgid-Bugs-To: https://git.janouch.name/p/logdiag/issues\n" +"POT-Creation-Date: 2021-10-22 22:16+0200\n" "PO-Revision-Date: 2018-06-25 04:11+0200\n" "Last-Translator: Přemysl Eric Janouch \n" "Language-Team: German \n" @@ -17,16 +17,16 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.0.8\n" -#: ../src/ld-window-main.c:931 +#: ../src/ld-window-main.c:937 #, c-format msgid "%d%%" msgstr "%d %%" -#: ../src/logdiag.c:146 +#: ../src/logdiag.c:147 msgid "- Schematic editor" msgstr "- Schema Editor" -#: ../src/ld-window-main.c:855 +#: ../src/ld-window-main.c:861 msgid "Close _without Saving" msgstr "Schließen _ohne Speichern" @@ -61,7 +61,7 @@ msgstr "Fehler beim Öffnen der Datei" msgid "Failed to save the diagram" msgstr "Fehler beim Speichern des Diagramms" -#: ../src/ld-window-main.c:853 +#: ../src/ld-window-main.c:859 msgid "If you don't save, changes will be permanently lost." msgstr "Wenn Sie nicht speichern, gehen alle Änderungen verloren." @@ -89,7 +89,7 @@ msgstr "Letzte nicht abgeschlossene Aktion wiederholen" msgid "Reset zoom level back to the default" msgstr "Zoom Bereich zurücksetzen" -#: ../src/ld-window-main.c:790 +#: ../src/ld-window-main.c:792 msgid "Save As..." msgstr "Speichern unter..." @@ -111,7 +111,7 @@ msgstr "" "Änderungen im Diagramm \"%s\" speichern bevor es beendet und ein Weiteres " "geöffnet wird?" -#: ../src/ld-window-main.c:893 +#: ../src/ld-window-main.c:899 #, c-format msgid "Save the changes to diagram \"%s\" before closing?" msgstr "Änderungen im Diagramm \"%s\" vor dem Schließen speichern?" @@ -164,6 +164,11 @@ msgstr "Letzte Aktion rückgangig machen" msgid "Unsaved Diagram" msgstr "Ungespeichertes Diagramm" +#: ../src/ld-window-main.c:806 +#, fuzzy +msgid "Untitled diagram" +msgstr "Ungespeichertes Diagramm" + #: ../src/ld-window-main.c:171 msgid "Zoom _Out" msgstr "Zoom _heraus" @@ -244,7 +249,7 @@ msgstr "_Ansicht" msgid "_Zoom In" msgstr "_Hineinzoomen" -#: ../src/ld-window-main.c:977 +#: ../src/ld-window-main.c:983 msgid "translator-credits" msgstr "Andy J." diff --git a/po/logdiag.pot b/po/logdiag.pot index ebab2c9..633f059 100644 --- a/po/logdiag.pot +++ b/po/logdiag.pot @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: logdiag 0.2.0\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-27 04:52+0200\n" +"Report-Msgid-Bugs-To: https://git.janouch.name/p/logdiag/issues\n" +"POT-Creation-Date: 2021-10-22 22:16+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -206,29 +206,33 @@ msgstr "" msgid "Open..." msgstr "" -#: ../src/ld-window-main.c:790 +#: ../src/ld-window-main.c:792 msgid "Save As..." msgstr "" -#: ../src/ld-window-main.c:853 +#: ../src/ld-window-main.c:806 +msgid "Untitled diagram" +msgstr "" + +#: ../src/ld-window-main.c:859 msgid "If you don't save, changes will be permanently lost." msgstr "" -#: ../src/ld-window-main.c:855 +#: ../src/ld-window-main.c:861 msgid "Close _without Saving" msgstr "" -#: ../src/ld-window-main.c:893 +#: ../src/ld-window-main.c:899 #, c-format msgid "Save the changes to diagram \"%s\" before closing?" msgstr "" -#: ../src/ld-window-main.c:931 +#: ../src/ld-window-main.c:937 #, c-format msgid "%d%%" msgstr "" -#: ../src/ld-window-main.c:977 +#: ../src/ld-window-main.c:983 msgid "translator-credits" msgstr "" @@ -236,7 +240,7 @@ msgstr "" msgid "[FILE...]" msgstr "" -#: ../src/logdiag.c:146 +#: ../src/logdiag.c:147 msgid "- Schematic editor" msgstr "" diff --git a/po/make-template.sh b/po/make-template.sh index d86ea81..67b3295 100755 --- a/po/make-template.sh +++ b/po/make-template.sh @@ -1,36 +1,21 @@ -#!/bin/bash -# This script makes a translation template -# The reason for this not being inside CMakeLists.txt -# is that the translator should not need to run -# the whole configure process to get this single stupid file. +#!/bin/sh -e +# This shell script generates the translation template. +# +# The reason for this not being inside CMakeLists.txt is that the translator +# should not need to run the whole configuration process just to get this file. +dir=$(dirname $0) -# Source files -SOURCES=$(echo ../{src,liblogdiag}/*.c) +export LC_ALL=C -# Get the package name from CMakeLists.txt -PACKAGE=$(sed -n '/^[ \t]*[pP][rR][oO][jJ][eE][cC][tT][ \t]*([ \t]*\([^ \t)]\{1,\}\).*).*/{s//\1/p;q}' \ - ../CMakeLists.txt) - -# Get the package version from CMakeLists.txt -EXP_BEG='/^[ \t]*[sS][eE][tT][ \t]*([ \t]*project_VERSION_' -EXP_END='[ \t]\{1,\}"\{0,1\}\([^)"]\{1,\}\)"\{0,1\}).*/{s//\1/p;q}' - -MAJOR=$(sed -n "${EXP_BEG}MAJOR${EXP_END}" ../CMakeLists.txt) -MINOR=$(sed -n "${EXP_BEG}MINOR${EXP_END}" ../CMakeLists.txt) -PATCH=$(sed -n "${EXP_BEG}PATCH${EXP_END}" ../CMakeLists.txt) - -if [ "$MAJOR" != "" ]; then - VERSION=$MAJOR - if [ "$MINOR" != "" ]; then - VERSION=$VERSION.$MINOR - if [ "$PATCH" != "" ]; then - VERSION=$VERSION.$PATCH - fi - fi +re='^[ \t]*project *( *\([^ \t)]\{1,\}\) \{1,\}VERSION \{1,\}\([^ \t)]\{1,\}\).*' +package=$(sed -n "s/$re/\\1/p" "$dir/../CMakeLists.txt") +version=$(sed -n "s/$re/\\2/p" "$dir/../CMakeLists.txt") +if [ -z "$package" -o -z "$version" ]; then + echo "Failed to get information from CMakeLists.txt" + exit 1 fi -# Finally make the template -xgettext -LC -k_ -kN_ $SOURCES -o "$PACKAGE".pot \ - --package-name="$PACKAGE" --package-version="$VERSION" \ - --copyright-holder="Přemysl Eric Janouch" - +xgettext -LC -k_ -kN_ "$dir"/../{src,liblogdiag}/*.c -o "$dir/$package.pot" \ + --package-name="$package" --package-version="$version" \ + --copyright-holder="Přemysl Eric Janouch" \ + --msgid-bugs-address="https://git.janouch.name/p/$package/issues" diff --git a/po/pl.po b/po/pl.po index 418d983..dfcb9c2 100644 --- a/po/pl.po +++ b/po/pl.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: logdiag\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-27 04:52+0200\n" +"Report-Msgid-Bugs-To: https://git.janouch.name/p/logdiag/issues\n" +"POT-Creation-Date: 2021-10-22 22:16+0200\n" "PO-Revision-Date: 2018-06-25 04:09+0200\n" "Last-Translator: Přemysl Eric Janouch \n" "Language-Team: Polish \n" @@ -17,16 +17,16 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.0.8\n" -#: ../src/ld-window-main.c:931 +#: ../src/ld-window-main.c:937 #, c-format msgid "%d%%" msgstr "%d%%" -#: ../src/logdiag.c:146 +#: ../src/logdiag.c:147 msgid "- Schematic editor" msgstr "- Edytor schematów" -#: ../src/ld-window-main.c:855 +#: ../src/ld-window-main.c:861 msgid "Close _without Saving" msgstr "Zamknąć _bez zapisu" @@ -59,7 +59,7 @@ msgstr "Pliku nie da się otworzyć" msgid "Failed to save the diagram" msgstr "Nie udało się zapisać wykresu" -#: ../src/ld-window-main.c:853 +#: ../src/ld-window-main.c:859 msgid "If you don't save, changes will be permanently lost." msgstr "Jeżeli nie zapiszesz zmian, zostaną one trwale utracone" @@ -87,7 +87,7 @@ msgstr "Powtórzy ostatnio cofniętą akcję" msgid "Reset zoom level back to the default" msgstr "Przywróci poziom zbliżenia na poziom wyjściowy" -#: ../src/ld-window-main.c:790 +#: ../src/ld-window-main.c:792 msgid "Save As..." msgstr "Zapisz jako..." @@ -109,7 +109,7 @@ msgid "" msgstr "" "Zapisać zmiany w wykresie \"%s\" przed jego zamknięciem i stworzeniem nowego?" -#: ../src/ld-window-main.c:893 +#: ../src/ld-window-main.c:899 #, c-format msgid "Save the changes to diagram \"%s\" before closing?" msgstr "Zapisać zmiany w wykresie \"%s\" przed jego zamknięciem?" @@ -162,6 +162,11 @@ msgstr "Cofnie ostatnią akcję" msgid "Unsaved Diagram" msgstr "Niezapisany Wykres" +#: ../src/ld-window-main.c:806 +#, fuzzy +msgid "Untitled diagram" +msgstr "Niezapisany Wykres" + #: ../src/ld-window-main.c:171 msgid "Zoom _Out" msgstr "_Oddalić widok" @@ -242,7 +247,7 @@ msgstr "_Widok" msgid "_Zoom In" msgstr "_Przybliżyć" -#: ../src/ld-window-main.c:977 +#: ../src/ld-window-main.c:983 msgid "translator-credits" msgstr "Robert Svoboda " diff --git a/po/sk.po b/po/sk.po index eed4152..8a2cac1 100644 --- a/po/sk.po +++ b/po/sk.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: logdiag\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-06-27 04:52+0200\n" +"Report-Msgid-Bugs-To: https://git.janouch.name/p/logdiag/issues\n" +"POT-Creation-Date: 2021-10-22 22:16+0200\n" "PO-Revision-Date: 2018-06-25 04:05+0200\n" "Last-Translator: Přemysl Eric Janouch \n" "Language-Team: Slovak \n" @@ -17,16 +17,16 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.0.8\n" -#: ../src/ld-window-main.c:931 +#: ../src/ld-window-main.c:937 #, c-format msgid "%d%%" msgstr "%d %%" -#: ../src/logdiag.c:146 +#: ../src/logdiag.c:147 msgid "- Schematic editor" msgstr "- Editor schém" -#: ../src/ld-window-main.c:855 +#: ../src/ld-window-main.c:861 msgid "Close _without Saving" msgstr "Zatvoriť _bez uloženia" @@ -59,7 +59,7 @@ msgstr "Nepodarilo sa otvoriť súbor" msgid "Failed to save the diagram" msgstr "Nepodarilo sa uložiť diagram" -#: ../src/ld-window-main.c:853 +#: ../src/ld-window-main.c:859 msgid "If you don't save, changes will be permanently lost." msgstr "Ak ich neuložíte, budú zmeny navždy stratené." @@ -87,7 +87,7 @@ msgstr "Vykoná naposledy vrátenú akciu" msgid "Reset zoom level back to the default" msgstr "Vráti priblíženie na východiskovú hodnotu" -#: ../src/ld-window-main.c:790 +#: ../src/ld-window-main.c:792 msgid "Save As..." msgstr "Uložiť ako..." @@ -108,7 +108,7 @@ msgid "" "Save the changes to diagram \"%s\" before closing it and opening another one?" msgstr "Uložiť zmeny v diagrame \"%s\" pred jeho zatvorením a otvorením iného?" -#: ../src/ld-window-main.c:893 +#: ../src/ld-window-main.c:899 #, c-format msgid "Save the changes to diagram \"%s\" before closing?" msgstr "Uložiť zmeny v diagrame \"%s\" pred jeho zatvorením?" @@ -161,6 +161,11 @@ msgstr "Vráti poslednú akciu" msgid "Unsaved Diagram" msgstr "Neuložený diagram" +#: ../src/ld-window-main.c:806 +#, fuzzy +msgid "Untitled diagram" +msgstr "Neuložený diagram" + #: ../src/ld-window-main.c:171 msgid "Zoom _Out" msgstr "_Oddialiť" @@ -241,7 +246,7 @@ msgstr "_Zobrazenie" msgid "_Zoom In" msgstr "_Priblížiť" -#: ../src/ld-window-main.c:977 +#: ../src/ld-window-main.c:983 msgid "translator-credits" msgstr "Miroslav Rigler " diff --git a/src/ld-window-main.c b/src/ld-window-main.c index caad72a..24efc3a 100644 --- a/src/ld-window-main.c +++ b/src/ld-window-main.c @@ -2,7 +2,7 @@ * ld-window-main.c * * This file is a part of logdiag. - * Copyright 2010, 2011, 2012, 2015 Přemysl Eric Janouch + * Copyright 2010 - 2021 Přemysl Eric Janouch * * See the file LICENSE for licensing information. * @@ -784,6 +784,8 @@ static void diagram_show_save_as_dialog (LdWindowMain *self) { GtkWidget *dialog; + GtkFileChooser *file_chooser; + gchar *filename; g_return_if_fail (LD_IS_WINDOW_MAIN (self)); @@ -796,15 +798,19 @@ diagram_show_save_as_dialog (LdWindowMain *self) gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (dialog), diagram_get_file_filter ()); + file_chooser = GTK_FILE_CHOOSER (dialog); if (self->priv->filename) - gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), - self->priv->filename); + gtk_file_chooser_set_filename (file_chooser, self->priv->filename); + else + { + filename = g_strdup_printf ("%s.ldd", _("Untitled diagram")); + gtk_file_chooser_set_current_name (file_chooser, filename); + g_free (filename); + } while (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) { - gchar *filename; - - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + filename = gtk_file_chooser_get_filename (file_chooser); if (diagram_save (self, GTK_WINDOW (dialog), filename)) { diagram_set_filename (self, filename); @@ -975,7 +981,7 @@ on_action_about (GtkAction *action, LdWindowMain *self) "logo-icon-name", PROJECT_NAME, "version", PROJECT_VERSION, "translator-credits", _("translator-credits"), - "copyright", "Copyright 2010 - 2018 Přemysl Eric Janouch", + "copyright", "Copyright 2010 - 2021 Přemysl Eric Janouch", "website", PROJECT_URL, NULL); } -- cgit v1.2.3-70-g09d2