Created
August 2, 2023 20:30
-
-
Save saivert/9e14f2535bb6f0b09718818bfb8e7214 to your computer and use it in GitHub Desktop.
gettext-rs development locale dir search path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() -> gtk::glib::ExitCode { | |
let mut textdomain = gettextrs::TextDomain::new(GETTEXT_PACKAGE); | |
if cfg!(debug_assertions) { | |
// Add extra search path for debug builds so we don't have to install | |
textdomain = textdomain.prepend("../locale-test"); | |
} | |
_ = textdomain.init().map_err(|x|{ | |
// TranslationNotFound is not a fatal error, fallback to msgid (english) | |
if !matches!(x, TextDomainError::TranslationNotFound(_)) { | |
panic!("Unable to setup gettext!") | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment