The Wayback Machine - https://web.archive.org/web/20220322021033/https://github.com/home-assistant/core/pull/34494
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

Rename translations dir for integrations #34494

Merged
merged 10 commits into from Apr 21, 2020
Merged

Conversation

ludeeus
Copy link
Member

@ludeeus ludeeus commented Apr 21, 2020

Breaking change

Not yet, but I will create a followup PR before 0.111 that will be breaking.
For now, if the old directory name is used the user will see a warning.

Proposed change

Rename .translations to translations to make it easier for users copying custom integrations.

Loading translations from the old path is kept with a warning that it will be removed in 0.111

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

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

@ludeeus
Copy link
Member Author

@ludeeus ludeeus commented Apr 21, 2020

Will use hassfest to rename the current directories and commit that, but if I do that now review will be hard with the 3000 file limit on GitHub, so I'll hold that off until this is done 😄

if is_platform:
filename = f"{parts[0]}.{language}.json"
return str(integration.file_path / ".translations" / filename)

# If it's a component that is just one file, we don't support translations
# Example custom_components/my_component.py
if integration.file_path.name != domain:
Copy link
Member

@balloob balloob Apr 21, 2020

Choose a reason for hiding this comment

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

I think that is_platform is now always filtered out by this check?

Copy link
Member Author

@ludeeus ludeeus Apr 21, 2020

Choose a reason for hiding this comment

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

Everything should still work as before.

Copy link
Member Author

@ludeeus ludeeus Apr 21, 2020

Choose a reason for hiding this comment

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

Took a look at the tests (which passed) and there are checks there for this.

script/hassfest/translations.py Outdated Show resolved Hide resolved
script/hassfest/translations.py Outdated Show resolved Hide resolved
@balloob balloob mentioned this pull request Apr 21, 2020
44 tasks
script/translations/download.py Outdated Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants