Browse Source

implement ngettext

translation2
Colin Reeder 3 years ago
parent
commit
78e02034a6
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/main.rs

+ 6
- 1
src/main.rs View File

@@ -57,14 +57,19 @@ lazy_static! {
struct GTTranslator {
base: qt_base_class!(trait QObject),
gettext: qt_method!(fn(&self, id: QString) -> QString),
ngettext: qt_method!(fn(&self, id: QString, id2: QString, count: u64) -> QString),
}

impl GTTranslator {
fn gettext<'a>(&self, msgid: QString) -> QString {
let msgid: String = msgid.into();
println!("msgid: {}", msgid);
TRANSLATIONS.gettext(&msgid).into()
}
fn ngettext<'a>(&self, msgid: QString, msgid_plural: QString, n: u64) -> QString {
let msgid: String = msgid.into();
let msgid_plural: String = msgid_plural.into();
TRANSLATIONS.ngettext(&msgid, &msgid_plural, n).into()
}
}

fn main() {


Loading…
Cancel
Save