i18n: Use gettext function instead of wrapper

No need to deviate from the default here.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/170>
This commit is contained in:
Sophie Herold 2023-04-11 00:02:28 +02:00 • committed by Christopher Davis
parent 695693cf74
commit f8cc9f5f84
16 changed files with 83 additions and 274 deletions

14
src/util/gettext.rs Normal file
View file

@ -0,0 +1,14 @@
pub use gettextrs::gettext;
fn freplace(mut s: String, args: &[&str]) -> String {
for arg in args {
s = s.replacen("{}", arg, 1);
}
s
}
pub fn gettext_f(format: &str, args: &[&str]) -> String {
let s = gettextrs::gettext(format);
freplace(s, args)
}