aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2024-01-21 20:00:01 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2024-01-22 19:55:21 +0000
commitfb2e6341af36d5da51131057db0b0baa8b4bb2be (patch)
tree4cf9662e715647503bf994619c0ef541e0ba87f6
parent9bfdab2d9e9941e79eba200af5332fc29d01bb4a (diff)
downloadqarepo-fb2e6341af36d5da51131057db0b0baa8b4bb2be.tar
qarepo-fb2e6341af36d5da51131057db0b0baa8b4bb2be.tar.gz
qarepo-fb2e6341af36d5da51131057db0b0baa8b4bb2be.tar.bz2
qarepo-fb2e6341af36d5da51131057db0b0baa8b4bb2be.tar.xz
qarepo-fb2e6341af36d5da51131057db0b0baa8b4bb2be.zip
Use string substitution to allow for better translated messages.
When a message includes a repository/package/file name, use sprintf to allow the name to be inserted at any arbitrary point in the message. This allows for more natural translations. Also remove any leading/trailing spaces from translatable strings, as these are being missed by translators.
-rw-r--r--po/qarepo.pot122
-rw-r--r--qarepo32
2 files changed, 90 insertions, 64 deletions
diff --git a/po/qarepo.pot b/po/qarepo.pot
index 39d69d3..ddbf830 100644
--- a/po/qarepo.pot
+++ b/po/qarepo.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2023-11-05 09:26+0000\n"
+"POT-Creation-Date: 2024-01-22 18:35+0000\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"
@@ -17,186 +17,202 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../qarepo:40
+#: ../qarepo:39
msgid "Disabled"
msgstr ""
-#: ../qarepo:41
+#: ../qarepo:40
msgid "Enabled"
msgstr ""
-#: ../qarepo:42
+#: ../qarepo:41
msgid "Needs update"
msgstr ""
-#: ../qarepo:43
+#: ../qarepo:42
msgid "Update failed"
msgstr ""
-#: ../qarepo:89
+#: ../qarepo:88
msgid "*** application will terminate ***"
msgstr ""
-#: ../qarepo:100
+#: ../qarepo:99
msgid "Mirror:"
msgstr ""
-#: ../qarepo:103
+#: ../qarepo:102
msgid "Release:"
msgstr ""
-#: ../qarepo:106
+#: ../qarepo:105
msgid "QA Repo:"
msgstr ""
#. PO: abbreviation of "architecture", e.g. i586, x86_64
-#: ../qarepo:110
+#: ../qarepo:109
msgid "Arch:"
msgstr ""
-#: ../qarepo:113
+#: ../qarepo:112
msgid "RPMs:"
msgstr ""
-#: ../qarepo:118
+#: ../qarepo:117
msgid "Status:"
msgstr ""
-#: ../qarepo:121
+#: ../qarepo:120
msgid "Quit"
msgstr ""
-#: ../qarepo:122
+#: ../qarepo:121
msgid "Disable"
msgstr ""
-#: ../qarepo:123 ../qarepo:419
+#: ../qarepo:122 ../qarepo:418
msgid "Enable"
msgstr ""
-#: ../qarepo:124
+#: ../qarepo:123
msgid "Clear"
msgstr ""
-#: ../qarepo:125 ../qarepo:736
+#: ../qarepo:124 ../qarepo:745
msgid "Downgrade"
msgstr ""
-#: ../qarepo:131
+#: ../qarepo:130
msgid ""
"fuzzy\n"
"version"
msgstr ""
#. PO: abbreviation of "add dependencies"
-#: ../qarepo:133
+#: ../qarepo:132
msgid ""
"add\n"
"deps"
msgstr ""
-#: ../qarepo:254
+#: ../qarepo:253
msgid "Dismiss"
msgstr ""
-#: ../qarepo:331
+#: ../qarepo:330
msgid "This may enable unwanted packages to be installed."
msgstr ""
-#: ../qarepo:358
+#: ../qarepo:357
msgid "This may stop some packages from being downgraded."
msgstr ""
-#: ../qarepo:383
+#: ../qarepo:382
msgid "Some updates_testing media are enabled."
msgstr ""
-#: ../qarepo:384
+#: ../qarepo:383
msgid "Please disable these media and try again."
msgstr ""
-#: ../qarepo:417
+#: ../qarepo:416
msgid "Update"
msgstr ""
+#. PO: preserve %s - it is replaced by the name of the repository
#: ../qarepo:470
-msgid "couldn't disable the local repository ['"
+#, perl-format
+msgid "couldn't disable the '%s' local repository"
msgstr ""
-#: ../qarepo:481
-msgid "couldn't enable the local repository ['"
+#. PO: preserve %s - it is replaced by the name of the repository
+#: ../qarepo:482
+#, perl-format
+msgid "couldn't enable the '%s' local repository"
msgstr ""
-#: ../qarepo:491
-msgid "couldn't update the local repository ['"
+#. PO: preserve %s - it is replaced by the name of the repository
+#: ../qarepo:493
+#, perl-format
+msgid "couldn't update the '%s' local repository"
msgstr ""
-#: ../qarepo:503
+#: ../qarepo:505
msgid "couldn't delete existing RPMs in the local repository"
msgstr ""
-#: ../qarepo:513
+#: ../qarepo:515
msgid "Updating"
msgstr ""
-#: ../qarepo:524
+#: ../qarepo:526
msgid "unsupported mirror URL type"
msgstr ""
-#: ../qarepo:573
-msgid "couldn't delete the downloaded synthesis file ["
+#. PO: preserve %s - it is replaced by the name of the file
+#: ../qarepo:576
+#, perl-format
+msgid "couldn't delete the downloaded synthesis file '%s'"
msgstr ""
-#: ../qarepo:593
-msgid " was not found in the remote repository"
+#. PO: preserve %s - it is replaced by the name of a package
+#: ../qarepo:597
+#, perl-format
+msgid "'%s' was not found in the remote repository"
msgstr ""
-#: ../qarepo:619
+#: ../qarepo:623
msgid "couldn't delete the old pubkey in the local repository"
msgstr ""
-#: ../qarepo:644
+#: ../qarepo:648
msgid "failed to download all the files"
msgstr ""
-#: ../qarepo:647
+#: ../qarepo:651
msgid "failed to update hdlist"
msgstr ""
-#: ../qarepo:660 ../qarepo:667
-msgid "fetching "
+#. PO: preserve %s - it is replaced by the URL of the file being downloaded
+#: ../qarepo:665 ../qarepo:674
+#, perl-format
+msgid "fetching %s"
msgstr ""
-#: ../qarepo:662 ../qarepo:675
-msgid "failed to download file ["
+#. PO: preserve %s - it is replaced by the URL of the file
+#: ../qarepo:668 ../qarepo:683
+#, perl-format
+msgid "failed to download file '%s'"
msgstr ""
-#: ../qarepo:681
-msgid "failed to link to file ["
+#. PO: preserve %s - it is replaced by the URL of the file
+#: ../qarepo:690
+#, perl-format
+msgid "failed to link to file '%s'"
msgstr ""
-#: ../qarepo:694
+#: ../qarepo:703
msgid "no synthesis file found in the local repository"
msgstr ""
-#: ../qarepo:715
+#: ../qarepo:724
msgid "none of the listed packages are installed"
msgstr ""
-#: ../qarepo:737
+#: ../qarepo:746
msgid "The following command may be used to downgrade the listed packages:"
msgstr ""
-#: ../qarepo:744
+#: ../qarepo:753
msgid "Error"
msgstr ""
-#: ../qarepo:745
+#: ../qarepo:754
msgid "The following error(s) occurred:"
msgstr ""
-#: ../qarepo:753
-msgid "ERROR: "
+#: ../qarepo:762
+msgid "ERROR:"
msgstr ""
#: ../qarepo.desktop.in.h:1
diff --git a/qarepo b/qarepo
index 9be79b1..4c1cee0 100644
--- a/qarepo
+++ b/qarepo
@@ -466,7 +466,8 @@ sub disable_repo {
if (system("$pkexec /usr/libexec/qarepo-helper disable $arch_type") == 0) {
$active_qa_repo = '';
} else {
- my $message = N("couldn't disable the local repository ['") . $qa_repo_name . "']";
+ # PO: preserve %s - it is replaced by the name of the repository
+ my $message = sprintf(N("couldn't disable the '%s' local repository"), $qa_repo_name);
show_error_dialogue($message, $fatal_message);
print_error($message, 'fatal');
}
@@ -477,7 +478,8 @@ sub enable_repo {
if (system("$pkexec /usr/libexec/qarepo-helper enable $arch_type $qa_repo/$arch") == 0) {
$active_qa_repo = $qa_repo;
} else {
- my $message = N("couldn't enable the local repository ['") . $qa_repo_name . "']";
+ # PO: preserve %s - it is replaced by the name of the repository
+ my $message = sprintf(N("couldn't enable the '%s' local repository"), $qa_repo_name);
show_error_dialogue($message);
print_error($message);
$active_qa_repo = '';
@@ -487,7 +489,8 @@ sub enable_repo {
sub update_repo {
my $arch_type = $arch eq 'x86_64' ? '64' : '32';
if (system("$pkexec /usr/libexec/qarepo-helper update $arch_type") != 0) {
- my $message = N("couldn't update the local repository ['") . $qa_repo_name . "']";
+ # PO: preserve %s - it is replaced by the name of the repository
+ my $message = sprintf(N("couldn't update the '%s' local repository"), $qa_repo_name);
show_error_dialogue($message);
print_error($message);
disable_repo();
@@ -569,7 +572,8 @@ sub sync_repo {
});
if (!unlink("$download_dir/$synthesis")) {
- my $message = N("couldn't delete the downloaded synthesis file [") . $download_dir . '/' . $synthesis . "]";
+ # PO: preserve %s - it is replaced by the name of the file
+ my $message = sprintf(N("couldn't delete the downloaded synthesis file '%s'"), $download_dir . '/' . $synthesis);
show_error_dialogue($message, $fatal_message);
print_error($message, 'fatal');
}
@@ -589,7 +593,8 @@ sub sync_repo {
$matched = 1;
}
}
- $matched or sync_error($request . N(" was not found in the remote repository"));
+ # PO: preserve %s - it is replaced by the name of a package
+ $matched or sync_error(sprintf(N("'%s' was not found in the remote repository"), $request));
}
# avoid infinite loop if we haven't found a match
last if @sync_errors;
@@ -656,14 +661,17 @@ sub sync_repo {
sub sync_file_rsync {
my ($src_url, $dst_dir) = @_;
- print N("fetching ") . $src_url . "\n";
+ # PO: preserve %s - it is replaced by the URL of the file being downloaded
+ print sprintf(N("fetching %s"), $src_url), "\n";
system("rsync -q $src_url $dst_dir") == 0
- or sync_error(N("failed to download file [") . $src_url . "]");
+ # PO: preserve %s - it is replaced by the URL of the file
+ or sync_error(sprintf(N("failed to download file '%s'"), $src_url));
}
sub sync_file_aria2 {
my ($src_url, $dst_dir) = @_;
- print N("fetching ") . $src_url . "\n";
+ # PO: preserve %s - it is replaced by the URL of the file being downloaded
+ print sprintf(N("fetching %s"), $src_url), "\n";
system("aria2c -q -d $dst_dir $src_url") == 0
and return 1;
@@ -671,13 +679,15 @@ sub sync_file_aria2 {
my $dst_file = $dst_dir . '/' . basename($src_url);
unlink($dst_file) if -e $dst_file;
- sync_error(N("failed to download file [") . $src_url . "]");
+ # PO: preserve %s - it is replaced by the URL of the file
+ sync_error(sprintf(N("failed to download file '%s'"), $src_url));
}
sub sync_file_link {
my ($src_file, $dst_dir) = @_;
-e $src_file && symlink($src_file, $dst_dir . '/' . basename($src_file))
- or sync_error(N("failed to link to file [") . $src_file . "]");
+ # PO: preserve %s - it is replaced by the URL of the file
+ or sync_error(sprintf(N("failed to link to file '%s'"), $src_file));
}
sub sync_error {
@@ -749,7 +759,7 @@ sub show_error_dialogue {
sub print_error {
my ($message, $o_fatal) = @_;
- print N("ERROR: ") . $message . ".\n";
+ print N("ERROR:"), " ", $message, ".\n";
$fatal_error = $o_fatal;
}