make string 123 MiB of 456 MiB used translatable (#2723)

This commit is contained in:
bjoern
2021-10-01 21:07:38 +02:00
committed by GitHub
parent b0902102a2
commit b6f88a9fca
3 changed files with 35 additions and 7 deletions

View File

@@ -460,18 +460,26 @@ impl Context {
ret += &match &resource.name {
Atom(resource_name) => {
format!(
"<b>{}:</b> {} of {} used",
"<b>{}:</b> {}",
&*escaper::encode_minimal(resource_name),
resource.usage.to_string(),
resource.limit.to_string(),
stock_str::part_of_total_used(
self,
resource.usage.to_string(),
resource.limit.to_string()
)
.await,
)
}
Message => {
format!(
"<b>{}:</b> {} of {} used",
"<b>{}:</b> {}",
stock_str::messages(self).await,
resource.usage.to_string(),
resource.limit.to_string(),
stock_str::part_of_total_used(
self,
resource.usage.to_string(),
resource.limit.to_string()
)
.await,
)
}
Storage => {
@@ -487,7 +495,7 @@ impl Context {
let limit = (resource.limit * 1024)
.file_size(file_size_opts::BINARY)
.unwrap_or_default();
format!("{} of {} used", usage, limit)
stock_str::part_of_total_used(self, usage, limit).await
}
};