mirror of
https://github.com/basnijholt/adaptive-lighting.git
synced 2026-09-11 22:34:04 +02:00
* Add scripts to auto update strings.json and services.yaml * Run services * simplify * Run strings * rerun * revert * allow unicode * Add CODEOWNERS * Update CODEOWNERS * set CONF_USE_DEFAULTS docs * add field_name * Auto run scripts * Update desc * Update README.md, strings.json, and services.yaml * double quotes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Update README.md, strings.json, and services.yaml * Add newline * sync changes between en.json and strings.json * Update README.md, strings.json, and services.yaml * double quotes * fix * Update README.md, strings.json, and services.yaml * Add comments * Remove comments * shorter * Update README.md, strings.json, and services.yaml * Rephrase * Update README.md, strings.json, and services.yaml * remove key from desc --------- Co-authored-by: Benjamin Auquite <halomastar@gmail.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
31 lines
908 B
Python
31 lines
908 B
Python
import json
|
|
from pathlib import Path
|
|
import sys
|
|
|
|
sys.path.append(str(Path(__file__).parent.parent))
|
|
|
|
from custom_components.adaptive_lighting import const # noqa: E402
|
|
|
|
strings_fname = "custom_components/adaptive_lighting/strings.json"
|
|
en_fname = "custom_components/adaptive_lighting/translations/en.json"
|
|
with open(strings_fname) as f:
|
|
strings = json.load(f)
|
|
|
|
data = {k: f"{k}: {const.DOCS[k]}" for k, _, _ in const.VALIDATION_TUPLES}
|
|
strings["options"]["step"]["init"]["data"] = data
|
|
|
|
with open(strings_fname, "w") as f:
|
|
json.dump(strings, f, indent=2, ensure_ascii=False)
|
|
f.write("\n")
|
|
|
|
|
|
# Sync changes from strings.json to en.json
|
|
with open(en_fname) as f:
|
|
en = json.load(f)
|
|
|
|
en["config"]["step"]["user"] = strings["config"]["step"]["user"]
|
|
en["options"]["step"]["init"]["data"] = data
|
|
|
|
with open(en_fname, "w") as f:
|
|
json.dump(en, f, indent=2, ensure_ascii=False)
|
|
f.write("\n")
|