UNPKG

@hakit/core

Version:

A collection of React hooks and helpers for Home Assistant to easily communicate with the Home Assistant WebSocket API.

46 lines (45 loc) 1.6 kB
import { localeTranslations as c } from "../../hooks/useLocale/locales/index.js"; var u = /* @__PURE__ */ ((n) => (n.language = "language", n.system = "system", n.comma_decimal = "comma_decimal", n.decimal_comma = "decimal_comma", n.quote_decimal = "quote_decimal", n.space_comma = "space_comma", n.none = "none", n))(u || {}), d = /* @__PURE__ */ ((n) => (n.language = "language", n.system = "system", n.DMY = "DMY", n.MDY = "MDY", n.YMD = "YMD", n))(d || {}), i = /* @__PURE__ */ ((n) => (n.language = "language", n.monday = "monday", n.tuesday = "tuesday", n.wednesday = "wednesday", n.thursday = "thursday", n.friday = "friday", n.saturday = "saturday", n.sunday = "sunday", n))(i || {}); const r = (n, a, e) => n.subscribeMessage(e, { type: "frontend/subscribe_user_data", key: a }), o = { "zh-cn": "zh-Hans", "zh-sg": "zh-Hans", "zh-my": "zh-Hans", "zh-tw": "zh-Hant", "zh-hk": "zh-Hant", "zh-mo": "zh-Hant", zh: "zh-Hant" // all other Chinese locales map to Traditional Chinese }; function t(n) { if (c.find((s) => s.code === n)) return n; const a = n.toLowerCase(); if (a in o) return o[a]; const e = c.find((s) => s.code.toLowerCase() === a); if (e) return e.code; if (n.includes("-")) return t(n.split("-")[0]); } function g(n) { const a = n.language; if (a) { const e = t(a); if (e) return e; } return a; } export { d as DateFormat, i as FirstWeekday, u as NumberFormat, t as findAvailableLanguage, g as getUserLocaleLanguage, r as subscribeFrontendUserData }; //# sourceMappingURL=frontend_data.js.map