mirror of https://github.com/wayvr-org/wayvr.git
Used locale in chrono
This commit is contained in:
parent
6f9ca5b3b7
commit
12ceebec6d
|
|
@ -932,6 +932,7 @@ dependencies = [
|
||||||
"iana-time-zone",
|
"iana-time-zone",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
|
"pure-rust-locales",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
"windows-link 0.2.1",
|
"windows-link 0.2.1",
|
||||||
]
|
]
|
||||||
|
|
@ -4194,6 +4195,12 @@ dependencies = [
|
||||||
"syn 2.0.113",
|
"syn 2.0.113",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pure-rust-locales"
|
||||||
|
version = "0.8.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "869675ad2d7541aea90c6d88c81f46a7f4ea9af8cd0395d38f11a95126998a0d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pxfm"
|
name = "pxfm"
|
||||||
version = "0.1.27"
|
version = "0.1.27"
|
||||||
|
|
@ -6314,6 +6321,7 @@ dependencies = [
|
||||||
"mint",
|
"mint",
|
||||||
"openxr",
|
"openxr",
|
||||||
"ovr_overlay",
|
"ovr_overlay",
|
||||||
|
"pure-rust-locales",
|
||||||
"regex",
|
"regex",
|
||||||
"rosc",
|
"rosc",
|
||||||
"rust-embed",
|
"rust-embed",
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,8 @@ xdg.workspace = true
|
||||||
|
|
||||||
ash = "^0.38.0" # must match vulkano
|
ash = "^0.38.0" # must match vulkano
|
||||||
bytes = { version = "1.11.1" }
|
bytes = { version = "1.11.1" }
|
||||||
chrono = "0.4.42"
|
chrono = { version = "0.4.42", features = [ "unstable-locales"]}
|
||||||
|
pure-rust-locales = "0.8.2"
|
||||||
chrono-tz = "0.10.4"
|
chrono-tz = "0.10.4"
|
||||||
config = "0.15.19"
|
config = "0.15.19"
|
||||||
dbus = { version = "0.9.9" }
|
dbus = { version = "0.9.9" }
|
||||||
|
|
|
||||||
|
|
@ -220,9 +220,24 @@ fn clock_on_tick(
|
||||||
common: &mut event::CallbackDataCommon,
|
common: &mut event::CallbackDataCommon,
|
||||||
data: &mut event::CallbackData,
|
data: &mut event::CallbackData,
|
||||||
) {
|
) {
|
||||||
|
let locale = {
|
||||||
|
let binding = common.i18n();
|
||||||
|
let locale = binding.get_locale();
|
||||||
|
match pure_rust_locales::Locale::try_from(locale.to_string().as_str()) {
|
||||||
|
Ok(loc) => loc,
|
||||||
|
Err(_) => pure_rust_locales::Locale::en_US,
|
||||||
|
}
|
||||||
|
};
|
||||||
let date_time = state.timezone.as_ref().map_or_else(
|
let date_time = state.timezone.as_ref().map_or_else(
|
||||||
|| format!("{}", Local::now().format(&state.format)),
|
|| format!("{}", Local::now().format_localized(&state.format, locale)),
|
||||||
|tz| format!("{}", Local::now().with_timezone(tz).format(&state.format)),
|
|tz| {
|
||||||
|
format!(
|
||||||
|
"{}",
|
||||||
|
Local::now()
|
||||||
|
.with_timezone(tz)
|
||||||
|
.format_localized(&state.format, locale)
|
||||||
|
)
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
let label = data.obj.get_as_mut::<WidgetLabel>().unwrap();
|
let label = data.obj.get_as_mut::<WidgetLabel>().unwrap();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue