mirror of
https://github.com/home-assistant/core.git
synced 2025-07-31 19:25:12 +02:00
Improve error messages from translation script (#102098)
Co-authored-by: Robert Resch <robert@resch.dev>
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
"""Find translation keys that are in Lokalise but no longer defined in source."""
|
||||
import argparse
|
||||
import json
|
||||
|
||||
from .const import CORE_PROJECT_ID, FRONTEND_DIR, FRONTEND_PROJECT_ID, INTEGRATIONS_DIR
|
||||
from .error import ExitApp
|
||||
from .lokalise import get_api
|
||||
from .util import get_base_arg_parser
|
||||
from .util import get_base_arg_parser, load_json_from_path
|
||||
|
||||
|
||||
def get_arguments() -> argparse.Namespace:
|
||||
@@ -46,9 +45,9 @@ def find_core():
|
||||
|
||||
translations = int_dir / "translations" / "en.json"
|
||||
|
||||
strings_json = json.loads(strings.read_text())
|
||||
strings_json = load_json_from_path(strings)
|
||||
if translations.is_file():
|
||||
translations_json = json.loads(translations.read_text())
|
||||
translations_json = load_json_from_path(translations)
|
||||
else:
|
||||
translations_json = {}
|
||||
|
||||
@@ -69,8 +68,8 @@ def find_frontend():
|
||||
|
||||
missing_keys = []
|
||||
find_extra(
|
||||
json.loads(source.read_text()),
|
||||
json.loads(translated.read_text()),
|
||||
load_json_from_path(source),
|
||||
load_json_from_path(translated),
|
||||
"",
|
||||
missing_keys,
|
||||
)
|
||||
|
Reference in New Issue
Block a user