mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 02:49:40 +00:00
Support serving of backend translations (#12453)
* Add view to support backend translation fetching * Load backend translations from component json * Translations for season sensor * Scripts to merge and unpack Lokalise translations * Fix copy paste error * Serve post-lokalise translations to frontend * Linting * Auto-deploy translations with Travis * Commit post-lokalise translation files * Split logic into more helper functions * Fall back to English for missing keys * Move local translation copies to `.translations` * Linting * Initial tests * Remove unnecessary file check * Convert translation helper to async/await * Convert translation helper tests to async/await * Use set subtraction to find missing_components * load_translation_files use component->file mapping * Remove duplicated resources fetching Get to take advantage of the slick Python 3.5 dict merging here. * Switch to live project ID
This commit is contained in:
committed by
Paulus Schoutsen
parent
a60712d826
commit
b434ffba2d
@@ -32,13 +32,13 @@ def load_json(filename: str, default: Union[List, Dict] = _UNDEFINED) \
|
||||
return {} if default is _UNDEFINED else default
|
||||
|
||||
|
||||
def save_json(filename: str, config: Union[List, Dict]):
|
||||
def save_json(filename: str, data: Union[List, Dict]):
|
||||
"""Save JSON data to a file.
|
||||
|
||||
Returns True on success.
|
||||
"""
|
||||
try:
|
||||
data = json.dumps(config, sort_keys=True, indent=4)
|
||||
data = json.dumps(data, sort_keys=True, indent=4)
|
||||
with open(filename, 'w', encoding='utf-8') as fdesc:
|
||||
fdesc.write(data)
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user