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:
parent
695693cf74
commit
f8cc9f5f84
16 changed files with 83 additions and 274 deletions
14
src/util/gettext.rs
Normal file
14
src/util/gettext.rs
Normal 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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue