mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Update extract-strings.py and transform-string.py for ninja
This commit is contained in:
parent
f05e5b448d
commit
1f347d09d5
2 changed files with 3 additions and 3 deletions
|
@ -14,7 +14,7 @@ from fluent.syntax import parse
|
||||||
from fluent.syntax.ast import Junk
|
from fluent.syntax.ast import Junk
|
||||||
from fluent.syntax.serializer import serialize_element
|
from fluent.syntax.serializer import serialize_element
|
||||||
|
|
||||||
root = os.environ["BUILD_WORKSPACE_DIRECTORY"]
|
root = ".."
|
||||||
ftl_files = glob.glob(os.path.join(root, "ftl", "core", "*.ftl"), recursive=True)
|
ftl_files = glob.glob(os.path.join(root, "ftl", "core", "*.ftl"), recursive=True)
|
||||||
keys_by_value: dict[str, list[str]] = {}
|
keys_by_value: dict[str, list[str]] = {}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import os
|
||||||
from fluent.syntax import parse, serialize
|
from fluent.syntax import parse, serialize
|
||||||
from fluent.syntax.ast import Junk
|
from fluent.syntax.ast import Junk
|
||||||
|
|
||||||
template_root = os.environ["BUILD_WORKSPACE_DIRECTORY"]
|
template_root = ".."
|
||||||
template_files = glob.glob(
|
template_files = glob.glob(
|
||||||
os.path.join(template_root, "ftl", "*", "*.ftl"), recursive=True
|
os.path.join(template_root, "ftl", "*", "*.ftl"), recursive=True
|
||||||
)
|
)
|
||||||
|
@ -34,7 +34,7 @@ def transform_string_in_file(path):
|
||||||
raise Exception(f"file had junk! {path} {ent}")
|
raise Exception(f"file had junk! {path} {ent}")
|
||||||
if getattr(ent, "id", None):
|
if getattr(ent, "id", None):
|
||||||
key = ent.id.name
|
key = ent.id.name
|
||||||
for (target_key, src, dst) in target_repls:
|
for target_key, src, dst in target_repls:
|
||||||
if key == target_key:
|
if key == target_key:
|
||||||
for elem in ent.value.elements:
|
for elem in ent.value.elements:
|
||||||
newval = elem.value.replace(src, dst)
|
newval = elem.value.replace(src, dst)
|
||||||
|
|
Loading…
Reference in a new issue