diff --git a/README.md b/README.md
index 0276fde..ccf3145 100644
--- a/README.md
+++ b/README.md
@@ -248,5 +248,6 @@ More can be found by exploring `cardTools.hass().resources`.
- Updated recommendation for how to check if `card-tools` exists.
- Added `hasTemplate()` to documentation.
- Added `args()` function.
+- Added `localize()` function.
---
diff --git a/card-modder.js b/card-modder.js
deleted file mode 100644
index 18927e8..0000000
--- a/card-modder.js
+++ /dev/null
@@ -1,74 +0,0 @@
-customElements.whenDefined('card-tools').then(() => {
-class CardModder extends cardTools.litElement() {
-
- setConfig(config) {
- cardTools.checkVersion(0.3);
-
- if(!config || !config.card) {
- throw new Error("Card config incorrect");
- }
- if(Array.isArray(config.card)) {
- throw new Error("It says 'card', not 'cardS'. Remove the dash.");
- }
- this._config = config;
- this.card = cardTools.createCard(config.card);
- this.templated = [];
- this.attempts = 0;
- }
-
- render() {
- return cardTools.litHtml()`
-
${this.card}
- `;
- }
-
- firstUpdated() {
- this._cardMod();
- }
-
- _cardMod() {
- if(!this._config.style) return;
-
- let target = null;
- target = target || this.card.querySelector("ha-card");
- target = target || this.card.shadowRoot && this.card.shadowRoot.querySelector("ha-card");
- target = target || this.card.firstChild && this.card.firstChild.shadowRoot && this.card.firstChild.shadowRoot.querySelector("ha-card");
- if(!target && !this.attempts) // Try twice
- setTimeout(() => this._cardMod(), 100);
- this.attempts++;
- target = target || this.card;
-
- for(var k in this._config.style) {
- if(cardTools.hasTemplate(this._config.style[k]))
- this.templated.push(k);
- target.style.setProperty(k, cardTools.parseTemplate(this._config.style[k]));
- }
- this.target = target;
- }
-
- set hass(hass) {
- if(this.card) this.card.hass = hass;
- if(this.templated)
- this.templated.forEach((k) => {
- this.target.style.setProperty(k, cardTools.parseTemplate(this._config.style[k], ''));
- });
- }
-
- getCardSize() {
- if(this._config && this._config.report_size)
- return this._config.report_size;
- if(this.card)
- return typeof this.card.getCardSize === "function" ? this.card.getCardSize() : 1;
- return 1;
- }
-}
-
-customElements.define('card-modder', CardModder);
-});
-
-window.setTimeout(() => {
- if(customElements.get('card-tools')) return;
- customElements.define('card-modder', class extends HTMLElement{
- setConfig() { throw new Error("Can't find card-tools. See https://github.com/thomasloven/lovelace-card-tools");}
- });
-}, 2000);
diff --git a/card-tools.js b/card-tools.js
index 9c47acb..bc96e44 100644
--- a/card-tools.js
+++ b/card-tools.js
@@ -181,6 +181,7 @@ class {
}
static parseTemplate(text, error) {
+ if(typeof(text) !== "string") return text;
const _parse = (str) => {
try {
str = str.replace(/^\[\[\s+|\s+\]\]$/g, '')