vinteo / hass-opensprinkler

OpenSprinkler Integration for Home Assistant
MIT License
205 stars 40 forks source link

chore-cleanup-translations #242

Closed EdLeckert closed 1 year ago

EdLeckert commented 1 year ago

Cleanup of translations and minor adjustments. Looks worse than it is because strings.json was overwritten (and can be ignored).

  1. While I couldn't find a definitive reference in the "official" docs, the consensus seems to be that strings.json should be exactly the same as the primary language in the translations folder, en.json. This is probably for backward compatibility, and the duplicate hopefully can eventually go away. Have copied en.json to strings.json.
  2. Error strings do not get translated in non-core integrations. Converted them to the text in core: homeassistant/strings.json
  3. Slightly out of scope, but errors for badly formatted URLs during config flow were falling thru to the generic Exception and getting displayed as "Unexpected exception". Now trap the aiohttp InvalidURL exception and display message showing example formatting.

Here's the existing behavior for a "cannot_connect" error, as in wrong IP address:

NotTranslated

New behavior:

FailedToConnect

Also for invalid url formatting:

URLIsMalformed

Finally, invalid authentication:

InvalidAuthentication

Let me know what you think.

sonarcloud[bot] commented 1 year ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication