diff --git a/druid-shell/Cargo.toml b/druid-shell/Cargo.toml index 2055654ef2..5815f9d1ba 100755 --- a/druid-shell/Cargo.toml +++ b/druid-shell/Cargo.toml @@ -96,7 +96,7 @@ js-sys = "0.3.44" [target.'cfg(target_arch="wasm32")'.dependencies.web-sys] version = "0.3.44" -features = ["Window", "MouseEvent", "CssStyleDeclaration", "WheelEvent", "KeyEvent", "KeyboardEvent"] +features = ["Window", "MouseEvent", "CssStyleDeclaration", "WheelEvent", "KeyEvent", "KeyboardEvent", "Navigator"] [dev-dependencies] piet-common = { version = "=0.4.1", features = ["png"] } diff --git a/druid-shell/src/platform/web/application.rs b/druid-shell/src/platform/web/application.rs index 9d685a2e75..51669d4a11 100644 --- a/druid-shell/src/platform/web/application.rs +++ b/druid-shell/src/platform/web/application.rs @@ -36,7 +36,8 @@ impl Application { } pub fn get_locale() -> String { - //TODO ahem - "en-US".into() + web_sys::window() + .and_then(|w| w.navigator().language()) + .unwrap_or_else(|| "en-US".into()) } }