Commit df4a8d9a authored by Felix Häcker's avatar Felix Häcker

Only use translation context where it is really necessary. #75 / #71

parent 92ed8097
Pipeline #182190 passed with stage
in 6 minutes and 47 seconds
......@@ -72,11 +72,15 @@ public class Fragments.App : Gtk.Application {
private void remove_completed_torrents() {
Gtk.MessageDialog msg = new Gtk.MessageDialog (App.window, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE, "");
msg.secondary_text = C_("Text displayed in the modal when the user removes all finished torrents", "This will only remove torrents from Fragments, but will keep the downloaded content.");
msg.text = C_("Title of the modal when the user removes all finished torrents", "Remove all finished Torrents?");
// Translators: Text displayed in the modal when the user removes all finished torrents
msg.secondary_text = _("This will only remove torrents from Fragments, but will keep the downloaded content.");
// Translators: Title of the modal when the user removes all finished torrents
msg.text = _("Remove all finished Torrents?");
msg.add_button(C_("Button in the modal when the user removes all finished torrents", "Cancel"), 0);
msg.add_button(C_("Button in the modal when the user removes all finished torrents", "Remove"), 1);
// Translators: Button in the modal when the user removes all finished torrents
msg.add_button(_("Cancel"), 0);
// Translators: Button in the modal when the user removes all finished torrents
msg.add_button(_("Remove"), 1);
msg.response.connect ((response_id) => {
if(response_id == 1){
......@@ -102,12 +106,12 @@ public class Fragments.App : Gtk.Application {
Gtk.show_about_dialog (window,
logo_icon_name: "de.haeckerfelix.Fragments",
program_name: "Fragments",
comments: C_("In the about dialog", "A BitTorrent Client"),
comments: ("A BitTorrent Client"),
copyright: "© 2018 - 2019 Felix Häcker",
authors: authors,
artists: artists,
website: "https://gitlab.gnome.org/World/Fragments",
website_label: C_("In the about dialog", "GitLab Homepage"),
website_label: ("GitLab Homepage"),
version: Config.VERSION,
license_type: License.GPL_3_0);
}
......
......@@ -32,9 +32,12 @@ public class Fragments.SettingsWindow : Hdy.PreferencesWindow {
App.settings.bind("enable-notifications-new-torrent", notifications_new_torrent_switch, "active", SettingsBindFlags.DEFAULT);
download_folder_button.clicked.connect(() => {
Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog (C_("Title of the file chooser to select a torrent","Select download folder"), this, Gtk.FileChooserAction.SELECT_FOLDER);
chooser.add_button (C_("Button of the file chooser to select a torrent","Cancel"), Gtk.ResponseType.CANCEL);
chooser.add_button (C_("Button of the file chooser to select a torrent","Open"), Gtk.ResponseType.ACCEPT);
// Translators: Title of the file chooser to select a torrent
Gtk.FileChooserDialog chooser = new Gtk.FileChooserDialog (_("Select download folder"), this, Gtk.FileChooserAction.SELECT_FOLDER);
// Translators: Button of the file chooser to select a torrent
chooser.add_button (_("Cancel"), Gtk.ResponseType.CANCEL);
// Translators: Button of the file chooser to select a torrent
chooser.add_button (_("Open"), Gtk.ResponseType.ACCEPT);
chooser.set_default_response (Gtk.ResponseType.ACCEPT);
chooser.set_current_folder(App.settings.download_folder);
......
......@@ -143,7 +143,8 @@ public class Fragments.TorrentManager : Object{
// Send notification if new torrent gets added
if(App.settings.enable_notifications_new_torrent == true){
Utils.send_notification(C_("Message to display in notification center","New torrent added"), ftorrent.name, "list-add-symbolic");
// Translators: Message to display in notification center
Utils.send_notification(_("New torrent added"), ftorrent.name, "list-add-symbolic");
}
update_torrent(ftorrent);
......
......@@ -105,14 +105,19 @@ public class Fragments.TorrentRow : Gtk.ListBoxRow{
private void remove_torrent(){
Gtk.MessageDialog msg = new Gtk.MessageDialog (App.window, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.NONE, "");
msg.secondary_text = C_("Message displayed in the modal after a user removed a torrent","Once removed, continuing the transfer will require the torrent file or magnet link.");
msg.text = C_("Titled of the modal displayed after a user removed a torrent","Remove Torrent?");
// Translators: Message displayed in the modal after a user removed a torrent
msg.secondary_text = _("Once removed, continuing the transfer will require the torrent file or magnet link.");
// Translators: Titled of the modal displayed after a user removed a torrent
msg.text = _("Remove Torrent?");
msg.add_button(C_("Button of the modal displayed after a user removed a torrent","Cancel"), 0);
msg.add_button(C_("Button of the modal displayed after a user removed a torrent","Remove"), 1);
// Translators: Button of the modal displayed after a user removed a torrent
msg.add_button(_("Cancel"), 0);
// Translators: Button of the modal displayed after a user removed a torrent
msg.add_button(_("Remove"), 1);
Box message_area = (Box)msg.get_message_area();
CheckButton checkbutton = new CheckButton.with_label(C_("Checkbox label in the modal after a user removed a torrent","Remove downloaded data as well"));
// Translators: Checkbox label in the modal after a user removed a torrent
CheckButton checkbutton = new CheckButton.with_label(_("Remove downloaded data as well"));
checkbutton.set_visible(true);
message_area.add(checkbutton);
......
......@@ -83,7 +83,8 @@ public class Fragments.Torrent : Object{
torrent.stat_cached.activity == Transmission.Activity.SEED_WAIT) &&
App.settings.enable_notifications_downloaded == true){
Utils.send_notification(C_("Message to display in notifications center", "Torrent completely downloaded"), name, "folder-download-symbolic");
// Translators: Message to display in notifications center
Utils.send_notification(_("Torrent completely downloaded"), name, "folder-download-symbolic");
}
activity = torrent.stat_cached.activity;
......@@ -110,7 +111,7 @@ public class Fragments.Torrent : Object{
primary_text = Utils.generate_primary_text(this);
// Translators: First %i corresponds to the number of seeders, second %i to the number of active seeders
seeders_text = C_("In the main window, when torrent is expanded","%i (%i active)").printf(seeders, seeders_active);
seeders_text = _("%i (%i active)").printf(seeders, seeders_active);
char[40] buf = new char[40];
download_speed = Transmission.String.Units.speed_KBps (buf, torrent.stat_cached.pieceDownloadSpeed_KBps); notify_property("download-speed");
......
......@@ -33,28 +33,34 @@ public class Fragments.Utils{
public static string generate_primary_text(Torrent torrent){
if (torrent.downloaded == torrent.size)
/* Translators: First %s is the amount uploaded, second %s is the
* uploading speed */
return C_("Displayed under the torrent name in the main window when torrent download is finished","%s uploaded · %s").printf(torrent.uploaded, torrent.upload_speed);
* uploading speed
* Displayed under the torrent name in the main window when torrent
* download is finished */
return _("%s uploaded · %s").printf(torrent.uploaded, torrent.upload_speed);
else if (torrent.activity == Transmission.Activity.STOPPED || torrent.activity == Transmission.Activity.DOWNLOAD_WAIT)
/* Translators: First %s is the amount downloaded, second %s is the
* total torrent size */
return C_("Displayed under the torrent name in the main window when torrent is stopped","%s of %s").printf(torrent.downloaded, torrent.size);
* total torrent size
* Displayed under the torrent name in the main window when torrent
* is stopped */
return _("%s of %s").printf(torrent.downloaded, torrent.size);
else
/* Translators: First %s is the amount downloaded, second %s is the
* total torrent size, third %s is the download speed*/
return C_("Displayed under the torrent name in the main window when torrent is downloading","%s of %s · %s").printf(torrent.downloaded, torrent.size, torrent.download_speed);
* total torrent size, third %s is the download speed
* Displayed under the torrent name in the main window when torrent
* is downloading */
return _("%s of %s · %s").printf(torrent.downloaded, torrent.size, torrent.download_speed);
}
public static string generate_secondary_text(Torrent torrent){
string st = "";
switch(torrent.activity){
case Transmission.Activity.STOPPED: { st = C_("Status of a single torrent", "Paused"); break;}
case Transmission.Activity.STOPPED: { st = _("Paused"); break;}
case Transmission.Activity.DOWNLOAD: {
if(torrent.eta != uint.MAX && torrent.eta != 0 && torrent.eta != 4294967294)
st = "%s".printf(Utils.time_to_string(torrent.eta));
break;}
case Transmission.Activity.DOWNLOAD_WAIT: { st = C_("Status of a single torrent", "Queued"); break;}
case Transmission.Activity.CHECK: { st = C_("Status of a single torrent", "Checking…"); break;}
case Transmission.Activity.CHECK: { st = _("Checking…"); break;}
case Transmission.Activity.CHECK_WAIT: { st = C_("Status of a single torrent", "Queued"); break;}
}
return st;
......
......@@ -78,15 +78,18 @@ public class Fragments.Window : Gtk.ApplicationWindow {
[GtkCallback]
private void open_torrent_button_clicked(){
var filech = new Gtk.FileChooserNative (C_("Title of the file chooser when adding a torrent","Open torrents"), this, Gtk.FileChooserAction.OPEN, null, null);
// Translators: Title of the file chooser when adding a torrent
var filech = new Gtk.FileChooserNative (_("Open torrents"), this, Gtk.FileChooserAction.OPEN, null, null);
filech.set_select_multiple (true);
filech.set_current_folder_uri (GLib.Environment.get_home_dir ());
var all_files_filter = new Gtk.FileFilter ();
all_files_filter.set_filter_name (C_("Name of the filter in the file chooser when adding a torrent", "All files"));
// Translators: Name of the filter in the file chooser when adding a torrent
all_files_filter.set_filter_name (_("All files"));
all_files_filter.add_pattern ("*");
var torrent_files_filter = new Gtk.FileFilter ();
torrent_files_filter.set_filter_name (C_("Name of the filter in the file chooser when adding a torrent", "Torrent files"));
// Translators: Name of the filter in the file chooser when adding a torrent
torrent_files_filter.set_filter_name (_("Torrent files"));
torrent_files_filter.add_mime_type ("application/x-bittorrent");
filech.add_filter (torrent_files_filter);
filech.add_filter (all_files_filter);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment