diff --git a/deltachat-ffi/deltachat.h b/deltachat-ffi/deltachat.h index 11ba8b5cc..42ca674e2 100644 --- a/deltachat-ffi/deltachat.h +++ b/deltachat-ffi/deltachat.h @@ -5900,6 +5900,70 @@ void dc_event_unref(dc_event_t* event); /// `%1$s` will be replaced by human-readable date and time. #define DC_STR_DOWNLOAD_AVAILABILITY 100 +/// "Incoming Messages" +/// +/// Used as a headline in the connectivity view. +#define DC_STR_INCOMING_MESSAGES 103 + +/// "Outgoing Messages" +/// +/// Used as a headline in the connectivity view. +#define DC_STR_OUTGOING_MESSAGES 104 + +/// "Storage on %1$s" +/// +/// Used as a headline in the connectivity view. +/// +/// `%1$s` will be replaced by the domain of the configured email-address. +#define DC_STR_STORAGE_ON_DOMAIN 105 + +/// "One moment…" +/// +/// Used in the connectivity view when some information are not yet there. +#define DC_STR_ONE_MOMENT 106 + +/// "Connected" +/// +/// Used as status in the connectivity view. +#define DC_STR_CONNECTED 107 + +/// "Connecting…" +/// +/// Used as status in the connectivity view. +#define DC_STR_CONNTECTING 108 + +/// "Updating…" +/// +/// Used as status in the connectivity view. +#define DC_STR_UPDATING 109 + +/// "Sending…" +/// +/// Used as status in the connectivity view. +#define DC_STR_SENDING 110 + +/// "Your last message was sent successfully." +/// +/// Used as status in the connectivity view. +#define DC_STR_LAST_MSG_SENT_SUCCESSFULLY 111 + +/// "Error: %1$s" +/// +/// Used as status in the connectivity view. +/// +/// `%1$s` will be replaced by a possibly more detailed, typically english, error description. +#define DC_STR_ERROR 112 + +/// "Not supported by your provider." +/// +/// Used in the connectivity view. +#define DC_STR_NOT_SUPPORTED_BY_PROVIDER 113 + +/// "Messages" +/// +/// Used as a subtitle in quota context; can be plural always. +#define DC_STR_MESSAGES 114 + /** * @} */ diff --git a/src/quota.rs b/src/quota.rs index 82066a0d8..b632ca9cc 100644 --- a/src/quota.rs +++ b/src/quota.rs @@ -128,7 +128,7 @@ impl Context { let folders = get_watched_folders(self).await; get_unique_quota_roots_and_usage(folders, imap).await } else { - Err(anyhow!("Quota not supported by your provider.")) + Err(anyhow!(stock_str::not_supported_by_provider(self).await)) }; if let Ok(quota) = "a { diff --git a/src/scheduler/connectivity.rs b/src/scheduler/connectivity.rs index 8aa54c5ed..be96bbf3e 100644 --- a/src/scheduler/connectivity.rs +++ b/src/scheduler/connectivity.rs @@ -8,7 +8,7 @@ use crate::events::EventType; use crate::quota::{ QUOTA_ERROR_THRESHOLD_PERCENTAGE, QUOTA_MAX_AGE_SECONDS, QUOTA_WARN_THRESHOLD_PERCENTAGE, }; -use crate::{config::Config, dc_tools, scheduler::Scheduler}; +use crate::{config::Config, dc_tools, scheduler::Scheduler, stock_str}; use crate::{context::Context, log::LogExt}; use anyhow::{anyhow, Result}; use humansize::{file_size_opts, FileSize}; @@ -73,33 +73,33 @@ impl DetailedConnectivity { } } - fn to_string_imap(&self, _context: &Context) -> String { + async fn to_string_imap(&self, context: &Context) -> String { match self { - DetailedConnectivity::Error(e) => format!("Error: {}", e), + DetailedConnectivity::Error(e) => stock_str::error(context, e).await, DetailedConnectivity::Uninitialized => "Not started".to_string(), - DetailedConnectivity::Connecting => "Connecting…".to_string(), - DetailedConnectivity::Working => "Getting new messages…".to_string(), + DetailedConnectivity::Connecting => stock_str::connecting(context).await, + DetailedConnectivity::Working => stock_str::updating(context).await, DetailedConnectivity::InterruptingIdle | DetailedConnectivity::Connected => { - "Connected".to_string() + stock_str::connected(context).await } DetailedConnectivity::NotConfigured => "Not configured".to_string(), } } - fn to_string_smtp(&self, _context: &Context) -> String { + async fn to_string_smtp(&self, context: &Context) -> String { match self { - DetailedConnectivity::Error(e) => format!("Error: {}", e), + DetailedConnectivity::Error(e) => stock_str::error(context, e).await, DetailedConnectivity::Uninitialized => { - "(You did not try to send a message recently)".to_string() + "You did not try to send a message recently.".to_string() } - DetailedConnectivity::Connecting => "Connecting…".to_string(), - DetailedConnectivity::Working => "Sending…".to_string(), + DetailedConnectivity::Connecting => stock_str::connecting(context).await, + DetailedConnectivity::Working => stock_str::sending(context).await, // We don't know any more than that the last message was sent successfully; // since sending the last message, connectivity could have changed, which we don't notice // until another message is sent DetailedConnectivity::InterruptingIdle | DetailedConnectivity::Connected => { - "Your last message was sent successfully".to_string() + stock_str::last_msg_sent_successfully(context).await } DetailedConnectivity::NotConfigured => "Not configured".to_string(), } @@ -251,7 +251,7 @@ impl Context { /// One of: /// - DC_CONNECTIVITY_NOT_CONNECTED (1000-1999): Show e.g. the string "Not connected" or a red dot /// - DC_CONNECTIVITY_CONNECTING (2000-2999): Show e.g. the string "Connecting…" or a yellow dot - /// - DC_CONNECTIVITY_WORKING (3000-3999): Show e.g. the string "Getting new messages" or a spinning wheel + /// - DC_CONNECTIVITY_WORKING (3000-3999): Show e.g. the string "Updating…" or a spinning wheel /// - DC_CONNECTIVITY_CONNECTED (>=4000): Show e.g. the string "Connected" or a green dot /// /// We don't use exact values but ranges here so that we can split up @@ -380,7 +380,7 @@ impl Context { }; drop(lock); - ret += "