mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Remove legacy state translations (#20536)
* Remove legacy state translations https://github.com/home-assistant/core/pull/112023
This commit is contained in:
parent
382035a1d4
commit
e376efc579
@ -97,14 +97,3 @@ export const getHassTranslations = async (
|
|||||||
});
|
});
|
||||||
return result.resources;
|
return result.resources;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getHassTranslationsPre109 = async (
|
|
||||||
hass: HomeAssistant,
|
|
||||||
language: string
|
|
||||||
): Promise<Record<string, unknown>> => {
|
|
||||||
const result = await hass.callWS<{ resources: Record<string, unknown> }>({
|
|
||||||
type: "frontend/get_translations",
|
|
||||||
language,
|
|
||||||
});
|
|
||||||
return result.resources;
|
|
||||||
};
|
|
||||||
|
@ -169,10 +169,6 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
this._loadHassTranslations(this.hass!.language, "entity");
|
this._loadHassTranslations(this.hass!.language, "entity");
|
||||||
|
|
||||||
// Backwards compatibility for custom integrations
|
|
||||||
// @ts-ignore
|
|
||||||
this._loadHassTranslations(this.hass!.language, "state");
|
|
||||||
|
|
||||||
document.addEventListener(
|
document.addEventListener(
|
||||||
"visibilitychange",
|
"visibilitychange",
|
||||||
() => this._checkVisibility(),
|
() => this._checkVisibility(),
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { atLeastVersion } from "../common/config/version";
|
|
||||||
import { fireEvent } from "../common/dom/fire_event";
|
import { fireEvent } from "../common/dom/fire_event";
|
||||||
import { computeLocalize, LocalizeFunc } from "../common/translations/localize";
|
import { computeLocalize, LocalizeFunc } from "../common/translations/localize";
|
||||||
import {
|
import {
|
||||||
@ -9,7 +8,6 @@ import { debounce } from "../common/util/debounce";
|
|||||||
import {
|
import {
|
||||||
FirstWeekday,
|
FirstWeekday,
|
||||||
getHassTranslations,
|
getHassTranslations,
|
||||||
getHassTranslationsPre109,
|
|
||||||
NumberFormat,
|
NumberFormat,
|
||||||
saveTranslationPreferences,
|
saveTranslationPreferences,
|
||||||
TimeFormat,
|
TimeFormat,
|
||||||
@ -286,23 +284,6 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
|
|||||||
configFlow?: Parameters<typeof getHassTranslations>[4],
|
configFlow?: Parameters<typeof getHassTranslations>[4],
|
||||||
force = false
|
force = false
|
||||||
): Promise<LocalizeFunc> {
|
): Promise<LocalizeFunc> {
|
||||||
if (
|
|
||||||
__BACKWARDS_COMPAT__ &&
|
|
||||||
!atLeastVersion(this.hass!.connection.haVersion, 0, 109)
|
|
||||||
) {
|
|
||||||
if (category !== "state") {
|
|
||||||
return this.hass!.localize;
|
|
||||||
}
|
|
||||||
const resources = await getHassTranslationsPre109(this.hass!, language);
|
|
||||||
|
|
||||||
// Ignore the repsonse if user switched languages before we got response
|
|
||||||
if (this.hass!.language !== language) {
|
|
||||||
return this.hass!.localize;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this._updateResources(language, resources);
|
|
||||||
}
|
|
||||||
|
|
||||||
let alreadyLoaded: LoadedTranslationCategory;
|
let alreadyLoaded: LoadedTranslationCategory;
|
||||||
|
|
||||||
if (category in this.__loadedTranslations) {
|
if (category in this.__loadedTranslations) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user