ha-appliance-electromenager-cards

Development and translations

dist/ha-appliance-electromenager-cards.js is generated: edit src/ instead, then rebuild (Node.js, no dependencies):

node build.js           # writes dist/
node build.js --check   # fails if dist/ is out of date (run by CI)

HACS installs a single file, so build.js concatenates the files of src/ in the order it lists (like <script> tags in a page):

src/
  header.js            licence banner
  core/                the 28 core cards, sharing one scope (order matters)
    version.js  i18n.js  illustrations.js  definitions.js  helpers.js
    base.js  editor.js  style.js  register.js
    svg/<kind>.js      one illustration per kind: SVG.washer = () => `…`
    style/*.css        card styles, concatenated into STYLE (order listed in build.js)
  cards/*.js           self-contained cards (aquarium, linky, battery, …), one IIFE each
  i18n/<lang>.json     texts, one file per language

Portuguese translations

pt-PT.json and pt-BR.json are complete, independent translations of the English reference. Preserve keys, units, placeholders such as {n} and {t}, and configuration identifiers in backticks. Use concise labels that fit the card tiles.

Concept Portugal Brazil
Refrigerator Frigorífico Geladeira
Washing machine Máquina de lavar roupa Lavadora de roupas
Screen Ecrã Tela
Control Controlo Controle
Humidity Humidade Umidade
Flow rate Caudal Vazão
Leak Fuga Vazamento

Language resolution is shared by core cards, standalone cards, editors and the picker through window.applianceResolveLanguage. It preserves regional variants, accepts case and underscore variations, maps generic pt to pt-PT, retains Norwegian aliases and Serbian Latin, and falls back to English for unsupported languages.

After editing either Portuguese file, run node tests/portuguese.cjs, rebuild, and run node build.js --check. Open docs/tests.html through a local HTTP server for the browser regression suite. The demo discovers both Portuguese variants automatically from the built card schemas; select each language to inspect card names, states, alerts and longer labels at narrow widths.