feat: add native Tomie adapter and strict import compatibility checks
This commit is contained in:
1 parent
c8d83b3fe7
commit
57a4edcbfd
45 files changed
+2985
-71
No files matched your search
@@ -15,6 +15,7 @@ from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from app.converter.rpy_lexer import Cursor, Line, ParseError, parse_tree
|
||||
from app.converter.source import read_source
|
||||
|
||||
# Ren'Py language names -> BCP-47
|
||||
RENPY_LANGS = {
|
||||
@@ -141,14 +142,14 @@ def import_tl(game_dir: Path, modules: dict[str, list[dict[str, Any]]],
|
||||
loc = LocaleData(renpy=lang_dir.name)
|
||||
for f in sorted(lang_dir.rglob("*.rpy")):
|
||||
try:
|
||||
_read_tl_file(f.read_text(encoding="utf-8", errors="replace"), loc, by_line,
|
||||
_read_tl_file(read_source(f), loc, by_line,
|
||||
by_group)
|
||||
except ParseError as e:
|
||||
warn(f"Перевод {lang_dir.name}: ошибка разбора", f"{f.name}:{e.lineno}")
|
||||
if loc.lines or loc.strings:
|
||||
result[lang_code(lang_dir.name)] = loc
|
||||
if loc.unmatched:
|
||||
warn(f"Перевод {lang_dir.name}: реплики без пары в скрипте ({loc.unmatched})")
|
||||
warn(f"Перевод {lang_dir.name}: реплики без пары в скрипте ({loc.unmatched})", blocking=False)
|
||||
return result
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user