metadata: Centralize many loose ends
This commit is contained in:
parent
b6d578cc0a
commit
fe43bc3a4c
21 changed files with 179 additions and 195 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2023 Sophie Herold
|
||||
// Copyright (c) 2023-2024 Sophie Herold
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -17,15 +17,15 @@
|
|||
|
||||
pub use gettextrs::gettext;
|
||||
|
||||
fn freplace(mut s: String, args: &[&str]) -> String {
|
||||
fn freplace(mut s: String, args: impl IntoIterator<Item = impl AsRef<str>>) -> String {
|
||||
for arg in args {
|
||||
s = s.replacen("{}", arg, 1);
|
||||
s = s.replacen("{}", arg.as_ref(), 1);
|
||||
}
|
||||
|
||||
s
|
||||
}
|
||||
|
||||
pub fn gettext_f(format: &str, args: &[&str]) -> String {
|
||||
pub fn gettext_f(format: &str, args: impl IntoIterator<Item = impl AsRef<str>>) -> String {
|
||||
let s = gettextrs::gettext(format);
|
||||
freplace(s, args)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue