Remove legacy state translations (#20536)

* Remove legacy state translations

https://github.com/home-assistant/core/pull/112023
This commit is contained in:
J. Nick Koston 2024-04-17 23:33:07 -05:00 committed by GitHub
parent 382035a1d4
commit e376efc579
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 0 additions and 34 deletions

View File

@ -97,14 +97,3 @@ export const getHassTranslations = async (
});
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;
};

View File

@ -169,10 +169,6 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
// @ts-ignore
this._loadHassTranslations(this.hass!.language, "entity");
// Backwards compatibility for custom integrations
// @ts-ignore
this._loadHassTranslations(this.hass!.language, "state");
document.addEventListener(
"visibilitychange",
() => this._checkVisibility(),

View File

@ -1,4 +1,3 @@
import { atLeastVersion } from "../common/config/version";
import { fireEvent } from "../common/dom/fire_event";
import { computeLocalize, LocalizeFunc } from "../common/translations/localize";
import {
@ -9,7 +8,6 @@ import { debounce } from "../common/util/debounce";
import {
FirstWeekday,
getHassTranslations,
getHassTranslationsPre109,
NumberFormat,
saveTranslationPreferences,
TimeFormat,
@ -286,23 +284,6 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
configFlow?: Parameters<typeof getHassTranslations>[4],
force = false
): 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;
if (category in this.__loadedTranslations) {