Skip to content

Add config flow base strings#34523

Merged
balloob merged 3 commits intodevfrom
config-flow-base-strings
May 5, 2020
Merged

Add config flow base strings#34523
balloob merged 3 commits intodevfrom
config-flow-base-strings

Conversation

@balloob
Copy link
Copy Markdown
Member

@balloob balloob commented Apr 22, 2020

Breaking change

Proposed change

Adds common config flow strings.

  • Add common strings
  • Update scaffolding to use references
  • Copy existing translations to placeholders. Script done, not executed.
  • Go through existing strings.json and use references For follow-up PR
  • Add hassfest check to find strings that can use references For follow-up PR

Testing to do:

  • Validate translations for config flow template
  • Validate translations for discovery config flow template
  • Validate translations for oauth2 config flow template

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@ctalkington
Copy link
Copy Markdown
Contributor

just wonder would api_key be a common data string as well?

@balloob
Copy link
Copy Markdown
Member Author

balloob commented Apr 22, 2020

Yeah, and access token. Really anything that would ever be shared by more than 1 integration should be added.

@balloob balloob force-pushed the config-flow-base-strings branch from 7b77997 to 5e28ade Compare May 4, 2020 18:27
@balloob balloob marked this pull request as ready for review May 5, 2020 00:38
"""Migrate translations."""
# Import new common keys
migrate_project_keys_translations(
rename_keys(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's happening here is that we one-time rename these keys to the common keys. Then when strings are uploaded after merge, the old names are created again, but their new value is set up as a reference to the new name.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this script needs to run before merge.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge of this PR?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I will do that once CI passses.

@balloob balloob merged commit 34e35f6 into dev May 5, 2020
@balloob balloob deleted the config-flow-base-strings branch May 5, 2020 03:10
@lock lock Bot locked and limited conversation to collaborators May 6, 2020
Comment thread script/scaffold/generate.py
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants