custom-card-helpers
Version:
Set of helpful functions and types for Custom Card creators
14 lines (11 loc) • 390 B
text/typescript
import { HomeAssistant } from "./types";
export function computeRTL(hass: HomeAssistant) {
const lang = hass?.locale?.language || "en";
if (hass.translationMetadata.translations[lang]) {
return hass.translationMetadata.translations[lang].isRTL || false;
}
return false;
}
export function computeRTLDirection(hass: HomeAssistant) {
return computeRTL(hass) ? "rtl" : "ltr";
}