App: Add the definition of the text domain
This adds the definition of the text domain used by gettext to translate the strings of the user interface. gettext will search for a package named "fractal" in the directory "./fractal-gtk/po". Thus MO files containing the translations must be found in "./fractal-gtk/po/[LANG]/LC_MESSAGES/fractal.mo". Closes https://gitlab.gnome.org/World/fractal/issues/89
This commit is contained in:
parent
60367530ba
commit
ea0dfa0023
1 changed files with 8 additions and 0 deletions
|
@ -1,7 +1,9 @@
|
|||
extern crate gtk;
|
||||
extern crate gdk;
|
||||
extern crate gettextrs;
|
||||
|
||||
use self::gtk::prelude::*;
|
||||
use self::gettextrs::{setlocale, LocaleCategory, bindtextdomain, textdomain};
|
||||
use std::env;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::mpsc::channel;
|
||||
|
@ -79,6 +81,12 @@ impl App {
|
|||
let bk = Backend::new(tx);
|
||||
let apptx = bk.run();
|
||||
|
||||
// Set up the textdomain for gettext
|
||||
setlocale(LocaleCategory::LcAll, "");
|
||||
bindtextdomain("fractal", "./fractal-gtk/po");
|
||||
textdomain("fractal");
|
||||
|
||||
|
||||
let ui = uibuilder::UI::new();
|
||||
let window: gtk::Window = ui.builder
|
||||
.get_object("main_window")
|
||||
|
|
Loading…
Reference in a new issue