feat(os): add locale API (#391)

This commit is contained in:
Lucas Fernandes Nogueira
2023-05-23 22:29:57 -03:00
committed by GitHub
parent 5676e77209
commit 7e3034904c
6 changed files with 43 additions and 3 deletions
+7 -1
View File
@@ -68,6 +68,11 @@ pub fn tempdir() -> PathBuf {
std::env::temp_dir()
}
/// Returns the locale with the `BCP-47` language tag. If the locale couldnt be obtained, `None` is returned instead.
pub fn locale() -> Option<String> {
sys_locale::get_locale()
}
pub fn init<R: Runtime>() -> TauriPlugin<R> {
Builder::new("os")
.js_init_script(include_str!("api-iife.js").to_string())
@@ -76,7 +81,8 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
commands::version,
commands::kind,
commands::arch,
commands::tempdir
commands::tempdir,
commands::locale
])
.build()
}