mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Update country picker dialog in onboarding (#24551)
* Update country picker dialog in onboarding * Handle if language has no locale * Don't fall back to NL
This commit is contained in:
parent
1ac0092d4e
commit
6ed26407be
@ -8,7 +8,7 @@ import "./ha-list-item";
|
||||
import "./ha-select";
|
||||
import type { HaSelect } from "./ha-select";
|
||||
|
||||
const COUNTRIES = [
|
||||
export const COUNTRIES = [
|
||||
"AD",
|
||||
"AE",
|
||||
"AF",
|
||||
|
@ -7,7 +7,7 @@ import { fireEvent } from "../common/dom/fire_event";
|
||||
import type { LocalizeFunc } from "../common/translations/localize";
|
||||
import "../components/ha-alert";
|
||||
import "../components/ha-circular-progress";
|
||||
import "../components/ha-country-picker";
|
||||
import { COUNTRIES } from "../components/ha-country-picker";
|
||||
import type { ConfigUpdateValues } from "../data/core";
|
||||
import { saveCoreConfig } from "../data/core";
|
||||
import { countryCurrency } from "../data/currency";
|
||||
@ -131,6 +131,17 @@ class OnboardingCoreConfig extends LitElement {
|
||||
this._save(ev);
|
||||
return;
|
||||
}
|
||||
|
||||
// Set suggested country
|
||||
let suggested: string | undefined;
|
||||
if (navigator.language) {
|
||||
const lang = navigator.language.split("-").pop()!.toUpperCase();
|
||||
if (COUNTRIES.includes(lang)) {
|
||||
suggested = lang;
|
||||
}
|
||||
}
|
||||
this._country = suggested;
|
||||
|
||||
fireEvent(this, "onboarding-progress", { increase: 0.5 });
|
||||
await this.updateComplete;
|
||||
setTimeout(
|
||||
|
@ -8234,7 +8234,7 @@
|
||||
"osm_privacy_policy": "Privacy policy",
|
||||
"title_location_detect": "Do you want us to detect your location?",
|
||||
"intro_location_detect": "We can detect your location by making a one-time request to an external service.",
|
||||
"country_intro": "We would like to know the country your home is in, so we can use the correct units for you.",
|
||||
"country_intro": "We would like to know the country your home is in, so we can use the correct units.",
|
||||
"location_name": "Name of your Home Assistant installation",
|
||||
"location_name_default": "Home",
|
||||
"address_label": "Search address",
|
||||
|
Loading…
x
Reference in New Issue
Block a user