Chats: the activity panel, the model's level control, team size, model pictures
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
The activity panel full screen (Context, Outputs, Background tasks with the team's room, Plan), kept current from the events route, with a summary line above the composer that opens it; an agent's conversation read-only and a stop with confirmation. The effort control follows the model (none, a Thinking switch, the picker); Agents fewest/most where a team is offered; model pictures in the picker and the chat's title. gen-strings takes the server's translation of a sentence with named placeholders (SERVER_ENGLISH); all eight languages complete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
17 files changed
+1698
-54
No files matched your search
+28
-3
@@ -31,7 +31,7 @@ LANGS = ("cs", "de", "es", "fr", "hu", "it", "pl", "sk")
|
||||
HEADER = "<!-- Generated by scripts/gen-strings.py. Edit scripts/strings.py or strings_own.json. -->"
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).parent))
|
||||
from strings import STRINGS # noqa: E402
|
||||
from strings import SERVER_ENGLISH, STRINGS # noqa: E402
|
||||
|
||||
|
||||
def android(text: str) -> str:
|
||||
@@ -60,6 +60,31 @@ def server_catalogue(code: str, ref: str | None = None) -> dict[str, str]:
|
||||
return dict(getattr(module, "MESSAGES", {}))
|
||||
|
||||
|
||||
def numbered(server_english: str, translation: str) -> str:
|
||||
"""A server translation with its named placeholders (`%(n)s`) numbered as Android's
|
||||
(`%1$s`), in the order the server's English names them. `%%` stays as it is: both write a
|
||||
percent sign that way."""
|
||||
names: list[str] = []
|
||||
for name in re.findall(r"%\((\w+)\)s", server_english):
|
||||
if name not in names:
|
||||
names.append(name)
|
||||
for i, name in enumerate(names, start=1):
|
||||
translation = translation.replace(f"%({name})s", f"%{i}$s")
|
||||
return translation
|
||||
|
||||
|
||||
def server_text(catalogue: dict[str, str], key: str, english: str) -> str | None:
|
||||
"""The server's translation of a sentence: by the app's English, or by the server's own
|
||||
English for it (`SERVER_ENGLISH`), placeholders numbered."""
|
||||
if english in catalogue:
|
||||
return catalogue[english]
|
||||
source = SERVER_ENGLISH.get(key)
|
||||
if source and source in catalogue:
|
||||
text = numbered(source, catalogue[source])
|
||||
return None if "%(" in text else text
|
||||
return None
|
||||
|
||||
|
||||
def used_keys() -> set[str]:
|
||||
keys: set[str] = set()
|
||||
for path in (ROOT / "app/src").rglob("*"):
|
||||
@@ -105,8 +130,8 @@ def main() -> None:
|
||||
for key, english in STRINGS.items():
|
||||
if key == "app_name":
|
||||
continue
|
||||
text = mine.get(key) or catalogue.get(english)
|
||||
if text and text.count("%1$s") == english.count("%1$s"):
|
||||
text = mine.get(key) or server_text(catalogue, key, english)
|
||||
if text and all(text.count(f"%{i}$s") == english.count(f"%{i}$s") for i in (1, 2, 3)):
|
||||
out[key] = text
|
||||
write(RES / f"values-{code}", out)
|
||||
print(f"gen-strings: {code}: {len(out)}/{len(STRINGS) - 1}" + (f" (server {ref[:12]})" if ref else ""))
|
||||
|
||||
Reference in new issue
Block a user