Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test ensuring identical translation keys share fallback names #3702

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

TheJulianJES
Copy link
Collaborator

Proposed change

This PR adds a test ensuring that if multiple entity metadata entries share the same translation key (e.g. child_lock), that their fallback names also all match (e.g. "Child lock").

So, one quirk can't have "Children lock" and the other "Child lock" as a fallback name if they share the same translation key of child_lock.

Additional information

This is needed as Home Assistant has a strings.json file that maps translation keys to friendly names.
This file is updated when bumping ZHA in HA. New translation keys are added by a script and their friendly name will, by default, be their fallback name.
If there were multiple different values per translation key, it would be somewhat "random" which value/name ends up in the strings.json file.

We just enforce what HA requires: no more than one friendly name per translation key. Currently, everything already passes.

(cc @prairiesnpr)

Checklist

  • The changes are tested and work correctly
  • pre-commit checks pass / the code has been formatted using Black
  • Tests have been added to verify that the new code works

@TheJulianJES TheJulianJES marked this pull request as draft January 11, 2025 22:23
@TheJulianJES TheJulianJES force-pushed the tjj/quirks_v2_translation_key_check branch from 4d4242d to 80bc6c3 Compare January 11, 2025 22:42
Copy link

codecov bot commented Jan 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.86%. Comparing base (57bcec8) to head (80bc6c3).

Additional details and impacted files
@@           Coverage Diff           @@
##              dev    #3702   +/-   ##
=======================================
  Coverage   89.86%   89.86%           
=======================================
  Files         322      322           
  Lines       10387    10387           
=======================================
  Hits         9334     9334           
  Misses       1053     1053           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@TheJulianJES TheJulianJES marked this pull request as ready for review January 12, 2025 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant