mirror of
https://github.com/home-assistant/core.git
synced 2025-08-21 03:10:02 +00:00
.devcontainer
.github
.vscode
docs
homeassistant
machine
pylint
rootfs
script
hassfest
scaffold
translations
__init__.py
bootstrap
check_dirty
check_format
countries.py
currencies.py
gen_requirements_all.py
inspect_schemas.py
languages.py
lint
lint_and_test.py
monkeytype
pip_check
run-in-env.sh
server
setup
update
version_bump.py
tests
.core_files.yaml
.coveragerc
.dockerignore
.gitattributes
.gitignore
.hadolint.yaml
.pre-commit-config.yaml
.prettierignore
.readthedocs.yml
.strict-typing
.yamllint
CLA.md
CODEOWNERS
CODE_OF_CONDUCT.md
CONTRIBUTING.md
Dockerfile
Dockerfile.dev
LICENSE.md
MANIFEST.in
README.rst
build.yaml
codecov.yml
mypy.ini
pyproject.toml
requirements.txt
requirements_all.txt
requirements_docs.txt
requirements_test.txt
requirements_test_all.txt
requirements_test_pre_commit.txt
setup.cfg

* Allow configuring country and language in core config * Add script for updating list of countries * Use black for formatting * Fix quoting * Move country codes to a separate file * Address review comments * Add generated/countries.py * Get default language from owner account * Remove unused variable * Add script to generate list of supported languages * Add tests * Fix stale docsring * Use format_python_namespace * Correct async_user_store * Improve typing * Fix with_store decorator * Initialize language in core store migration * Fix startup * Tweak * Apply suggestions from code review Co-authored-by: Franck Nijhof <git@frenck.dev> * Update storage.py Co-authored-by: Franck Nijhof <git@frenck.dev>
26 lines
645 B
Python
26 lines
645 B
Python
"""Helper script to update language list from the frontend source."""
|
|
import json
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
import requests
|
|
|
|
from .hassfest.serializer import format_python_namespace
|
|
|
|
tag = sys.argv[1] if len(sys.argv) > 1 else "dev"
|
|
|
|
req = requests.get(
|
|
f"https://raw.githubusercontent.com/home-assistant/frontend/{tag}/src/translations/translationMetadata.json"
|
|
)
|
|
data = json.loads(req.content)
|
|
languages = set(data.keys())
|
|
|
|
Path("homeassistant/generated/languages.py").write_text(
|
|
format_python_namespace(
|
|
{
|
|
"LANGUAGES": languages,
|
|
},
|
|
generator="script.languages [frontend_tag]",
|
|
)
|
|
)
|