@@ -484,27 +484,27 @@ const oe=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t
- `}renderName(e){return this.config.show_name?z`
${this.config.name||e.attributes.friendly_name}
`:z``}renderState(e){if(!this.config.show_states)return z``;const t=this.hass.states[this.config.entity],i=e&&e.key in t.attributes,o=e&&e.key in t,a=i?t.attributes[e.key]:o?t[e.key]:this.hass.localize("state.default.unavailable"),r=Pt(a,this.hass.locale),n=z`
+ `}renderName(e){return this.config.show_name?z`
${this.config.name||e.attributes.friendly_name}
`:z``}renderState(e){if(!this.config.show_states)return z``;const t=this.hass.states[this.config.entity],i=e&&e.key in t.attributes,o=e&&e.key in t,a=i?t.attributes[e.key]:o?t[e.key]:this.hass.localize("state.default.unavailable"),r=Lt(a,this.hass.locale),n=z`
${e.icon&&this.renderIcon(e)}
- ${(e.label||"")+(vt(`states.${a}`)||r)+(e.unit||"")}
+ ${(e.label||"")+(Et(`states.${a}`)||r)+(e.unit||"")}
-
`;return`${e.key}_list`in t.attributes&&(i||o)?this.renderDropdown(n,e.key):n}renderAttribute(e){if(!this.config.show_attributes)return z``;const t=this.hass.states[this.config.entity],i=e.compute||(e=>e),o=e&&e.key in t.attributes,a=e&&e.key in t,r=o?i(t.attributes[e.key]):a?i(t[e.key]):this.hass.localize("state.default.unavailable"),n=Pt(r,this.hass.locale),s=z`
- ${e.icon&&this.renderIcon(e)}${(e.label||"")+(vt(`attributes_value.${r}`)||n)+(e.unit||"")}
-
`;return`${e.key}_list`in t.attributes&&(o||a)?this.renderDropdown(s,e.key):s}renderBody(e){if(!this.config.show_body)return z``;const t=this.hass.states[this.config.entity],i=e.compute||(e=>e),o=e&&e.key in t.attributes,a=e&&e.key in t,r=o?i(t.attributes[e.key]):a?i(t[e.key]):this.hass.localize("state.default.unavailable"),n=Pt(r,this.hass.locale);let s=30;e.height&&(s=e.height);let l,c,d,h,m,b,u,g,p="stretch",_="0px 0px 0px 13px",f="right",v="row",y="left",w="height: 100%; width: 2px;";switch(e.direction){case"right":f="right",y="left";break;case"up":_="0px",f="top",v="column-reverse",y="bottom",w="height: 2px; width: 100%;"}switch(e.positions.icon){case"outside":l=z`
${e.icon&&this.renderIconbody(e)} `;break;case"inside":c=z`
${e.icon&&this.renderIconbody(e)} `,_="0px";break;case"off":_="0px"}switch(e.positions.name){case"outside":d=z`
+
`;return`${e.key}_list`in t.attributes&&(i||o)?this.renderDropdown(n,e.key):n}renderAttribute(e){if(!this.config.show_attributes)return z``;const t=this.hass.states[this.config.entity],i=e.compute||(e=>e),o=e&&e.key in t.attributes,a=e&&e.key in t,r=o?i(t.attributes[e.key]):a?i(t[e.key]):this.hass.localize("state.default.unavailable"),n=Lt(r,this.hass.locale),s=z`
+ ${e.icon&&this.renderIcon(e)}${(e.label||"")+(Et(`attributes_value.${r}`)||n)+(e.unit||"")}
+
`;return`${e.key}_list`in t.attributes&&(o||a)?this.renderDropdown(s,e.key):s}renderBody(e){if(!this.config.show_body)return z``;const t=this.hass.states[this.config.entity],i=e.compute||(e=>e),o=e&&e.key in t.attributes,a=e&&e.key in t,r=o?i(t.attributes[e.key]):a?i(t[e.key]):this.hass.localize("state.default.unavailable"),n=Lt(r,this.hass.locale);let s=30;e.height&&(s=e.height);let l,c,d,h,b,m,u,g,p="stretch",_="0px 0px 0px 13px",f="right",v="row",y="left",w="height: 100%; width: 2px;";switch(e.direction){case"right":f="right",y="left";break;case"up":_="0px",f="top",v="column-reverse",y="bottom",w="height: 2px; width: 100%;"}switch(e.positions.icon){case"outside":l=z`
${e.icon&&this.renderIconbody(e)} `;break;case"inside":c=z`
${e.icon&&this.renderIconbody(e)} `,_="0px";break;case"off":_="0px"}switch(e.positions.name){case"outside":d=z`
${e.label||""}
- `,_="0px";break;case"inside":h=z`
${e.label||""} `}switch(e.positions.minmax){case"outside":m=z`
+ `,_="0px";break;case"inside":h=z`
${e.label||""} `}switch(e.positions.minmax){case"outside":b=z`
${e.min+(e.unit||"")}
/
${e.max+(e.unit||"")}
- `;break;case"inside":b=z`
+ `;break;case"inside":m=z`
${e.min+(e.unit||"")}
@@ -512,14 +512,14 @@ const oe=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t
${e.max+(e.unit||"")}
`}switch(e.positions.value){case"outside":u=z`
${(vt(`body_value.${r}`)||n)+(e.unit||"")}${(Et(`body_value.${r}`)||n)+(e.unit||"")}
`;break;case"inside":g=z`
${(vt(`body_value.${r}`)||n)+(e.unit||"")}${(Et(`body_value.${r}`)||n)+(e.unit||"")}
- `;break;case"off":_="0px"}const k=this._computeBarColor(e,Number(r)),x=this._computePercent(e,Number(r)),$=this._computePercent(e,e.target);let S=x,A=this._computePercent(e,e.target);A
+ `;break;case"off":_="0px"}const k=this._computeBarColor(e,Number(r)),x=this._computePercent(e,Number(r)),$=this._computePercent(e,e.target);let S=x,A=this._computePercent(e,e.target);A
${l} ${d}
t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t
- ${c} ${h} ${b} ${g}
+ ${c} ${h} ${m} ${g}
- ${m} ${u}
+ ${b} ${u}
- `;return`${e.key}_list`in t.attributes&&(o||a)?this.renderDropdown(O,e.key):O}renderIcon(e){const t=this.hass.states[this.config.entity],i="water"===e.key&&"water_icon"in this.stateObj.attributes?this.stateObj.attributes.water_icon:e.icon;return"none"!==t.attributes.problem&&"mdi:alert"===i?z``:z``}renderIconbody(e){const t="Water"===e.key&&"water_icon"in this.stateObj.attributes?this.stateObj.attributes.water_icon:e.icon;return z``;return`${e.key}_list`in t.attributes&&(o||a)?this.renderDropdown(E,e.key):E}renderIcon(e){const t=this.hass.states[this.config.entity],i="water"===e.key&&"water_icon"in this.stateObj.attributes?this.stateObj.attributes.water_icon:e.icon;return"none"!==t.attributes.problem&&"mdi:alert"===i?z``:z``}renderIconbody(e){const t="Water"===e.key&&"water_icon"in this.stateObj.attributes?this.stateObj.attributes.water_icon:e.icon;return z``}renderButton(e){return this.config.show_buttons?e&&!1!==e.show?z`t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t
@@ -576,4 +576,4 @@ const oe=e=>t=>"function"==typeof t?((e,t)=>(window.customElements.define(e,t),t
${a.map((e=>z`${e}`))}
- `}static get styles(){return Ot}_computeBarColor(e,t){let i;return i=e.severity?this._computeSeverityColor(e,t):"unavailable"==e?`var(--score-card-disabled-color, ${e.color})`:e.color,i}_computeSeverityColor(e,t){const i=e.severity;let o;return isNaN(t)?i.forEach((t=>{e==t.text&&(o=t.color)})):i.forEach((e=>{t>=e.from&&t<=e.to&&(o=e.color)})),null==o&&(o=e.color),o}_computePercent(e,t){if("unavailable"==e)return 0;if(isNaN(t))return 100;switch(e.direction){case"right-reverse":case"left-reverse":case"up-reverse":case"down-reverse":return 100-100*(t-e.min)/(e.max-e.min);default:return 100*(t-e.min)/(e.max-e.min)}}_moreInfo(){we(this,"hass-more-info",{entityId:this.config.entity})}};e([re({attribute:!1})],Tt.prototype,"hass",void 0),e([ne()],Tt.prototype,"config",void 0),e([ne()],Tt.prototype,"_configArray",void 0),e([ne()],Tt.prototype,"open",void 0),Tt=e([oe("body-miscale-card")],Tt);export{Tt as BodyMiScaleCard};
+ `}static get styles(){return Rt}_computeBarColor(e,t){let i;return i=e.severity?this._computeSeverityColor(e,t):"unavailable"==e?`var(--score-card-disabled-color, ${e.color})`:e.color,i}_computeSeverityColor(e,t){const i=e.severity;let o;return isNaN(t)?i.forEach((t=>{e==t.text&&(o=t.color)})):i.forEach((e=>{t>=e.from&&t<=e.to&&(o=e.color)})),null==o&&(o=e.color),o}_computePercent(e,t){if("unavailable"==e)return 0;if(isNaN(t))return 100;switch(e.direction){case"right-reverse":case"left-reverse":case"up-reverse":case"down-reverse":return 100-100*(t-e.min)/(e.max-e.min);default:return 100*(t-e.min)/(e.max-e.min)}}_moreInfo(){we(this,"hass-more-info",{entityId:this.config.entity})}};e([re({attribute:!1})],Gt.prototype,"hass",void 0),e([ne()],Gt.prototype,"config",void 0),e([ne()],Gt.prototype,"_configArray",void 0),e([ne()],Gt.prototype,"open",void 0),Gt=e([oe("body-miscale-card")],Gt);export{Gt as BodyMiScaleCard};
diff --git a/src/localize/languages/cn.json b/src/localize/languages/cn.json
new file mode 100644
index 0000000..48155e1
--- /dev/null
+++ b/src/localize/languages/cn.json
@@ -0,0 +1,113 @@
+{
+ "common": {
+ "version": "版本",
+ "name": "米家体脂称卡片",
+ "description": "米家体脂称卡片会显示你的体重以及相关身体状态",
+ "not_available": "BodyMiScale 不可用",
+ "toggle_power": "显示/隐藏更多详情,例如: BMI, kCal"
+ },
+ "states": {
+ "ok": "测量: OK",
+ "unknown": "状态: 未知",
+ "problem": "故障",
+ "none": "无",
+ "weight unavailable": "体重不可用",
+ "impedance unavailable": "阻抗不可用",
+ "weight unavailable, impedance unavailable": "体重不可用, 阻抗不可用",
+ "weight low": "体重过轻",
+ "impedance low": "阻抗低",
+ "weight low, impedance low": "体重过轻, 阻抗低",
+ "weight high": "体重过重",
+ "impedance high": "阻抗高",
+ "weight high, impedance high": "体重过重, 阻抗高",
+ "weight high, impedance low": "体重过重, 阻抗低",
+ "weight low, impedance high": "体重过轻, 阻抗高"
+ },
+ "attributes": {
+ "weight: ": "重量: ",
+ "impedance: ": "阻抗: ",
+ "height: ": "身高: ",
+ "age: ": "年龄: ",
+ "gender: ": "性别: "
+ },
+ "attributes_value": {
+ "male": "男",
+ "female": "女",
+ "unavailable kg": "不可用",
+ "unavailable ohm": "不可用"
+ },
+ "body": {
+ "bmi": "BMI",
+ "bmi_label": "BMI 标签",
+ "visceral_fat": "内脏脂肪",
+ "body_fat": "体脂",
+ "protein": "蛋白质",
+ "water": "水分",
+ "muscle_mass": "肌肉量",
+ "bone_mass": "骨量",
+ "weight": "体重",
+ "ideal": "理想体重",
+ "basal_metabolism": "基本代谢",
+ "body_type": "身体类型",
+ "metabolic_age": "代谢年龄"
+ },
+ "body_value": {
+ "Skinny": "偏瘦",
+ "Balanced-skinny": "健美型",
+ "Skinny-muscular": "偏瘦肌肉",
+ "Balanced": "标准型",
+ "Balanced-muscular": "标准肌肉",
+ "Lack-exercise": "缺乏运动",
+ "Thick-set": "结实型偏胖",
+ "Obese": "偏胖型",
+ "Overweight": "肥胖型",
+ "Underweight": "过轻",
+ "Normal or Healthy Weight": "正常或健康",
+ "Slight overweight": "轻微超重",
+ "Moderate obesity": "中度肥胖",
+ "Severe obesity": "过度肥胖",
+ "Massive obesity": "严重肥胖"
+ },
+ "unit": {
+ " years": " 岁"
+ },
+ "error": {
+ "missing_entity": "Please define an entity.",
+ "missing_entity_bodymiscale": "Please define a bodymiscale entity."
+ },
+ "editor": {
+ "entity": "Please select an account on the scale (required) !",
+ "image": "Background image (optional)",
+ "model": "ACTIVATE if the scale has 4 grey circles of 5 cm Ø on top",
+ "model1": "( = model 181B) !",
+ "model_aria_label_on": "Toggle model impedance on",
+ "model_aria_label_off": "Toggle model impedance off",
+ "unit": "Convert kg to lbs",
+ "unit_aria_label_on": "Toggle the conversion on",
+ "unit_aria_label_off": "Toggle the conversion off",
+ "show_name": "Show the name of the account as title ?",
+ "show_name_aria_label_on": "Toggle display name on",
+ "show_name_aria_label_off": "Toggle display name off",
+ "show_states": "Show State ?",
+ "show_states_aria_label_on": "Toggle display state on",
+ "show_states_aria_label_off": "Toggle display state off",
+ "show_attributes": "Show personal master data (top right) ?",
+ "show_attributes_aria_label_on": "Toggle display attributes on",
+ "show_attributes_aria_label_off": "Toggle display attributes off",
+ "show_toolbar": "Show advanced options ?",
+ "show_toolbar_aria_label_on": "Toggle display advanced options on",
+ "show_toolbar_aria_label_off": "Toggle display advanced options off",
+ "show_body": "Offer further measurement details",
+ "show_body1": "(lower half - icon chevron down will show those) ?",
+ "show_body_aria_label_on": "Toggle display body score on",
+ "show_body_aria_label_off": "Toggle display body score off",
+ "show_buttons": "Allow account switch ?",
+ "show_buttons_aria_label_on": "Toggle display buttons on",
+ "show_buttons_aria_label_off": "Toggle display buttons off",
+ "code_information": "CHANGES WILL ONLY APPEAR AFTER THEY HAVE BEEN SAVED.",
+ "header_options": "1. Card header options",
+ "body_options": "2. More card options",
+ "warning": "ATTENTION:",
+ "code_only_note": "Additional options are only available in the code editor."
+ }
+}
\ No newline at end of file
diff --git a/src/localize/localize.ts b/src/localize/localize.ts
index 7096e35..4fc7a50 100644
--- a/src/localize/localize.ts
+++ b/src/localize/localize.ts
@@ -1,3 +1,4 @@
+import * as cn from './languages/cn.json';
import * as de from './languages/de.json';
import * as en from './languages/en.json';
import * as fr from './languages/fr.json';
@@ -6,6 +7,7 @@ import * as pt_BR from './languages/pt-BR.json';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const languages: any = {
+ cn: cn,
de: de,
en: en,
fr: fr,
diff --git a/tracker.json b/tracker.json
index 27795e1..4732372 100644
--- a/tracker.json
+++ b/tracker.json
@@ -1,7 +1,7 @@
{
"body-miscale-card": {
- "updated_at": "2021-09-09",
- "version": "v5.6.2",
+ "updated_at": "2021-09-17",
+ "version": "v5.6.3",
"remote_location": "https://raw.githubusercontent.com/dckiller51/lovelace-body-miscale-card/master/dist/body-miscale-card.js",
"visit_repo": "https://github.com/dckiller51/lovelace-body-miscale-card",
"changelog": "https://github.com/dckiller51/lovelace-body-miscale-card/blob/master/CHANGELOG.md"