Skip to content

feat(contexto): trozos de componentes con su frase y líneas con su continuación - #39

Merged
Consterna merged 1 commit into
mainfrom
feat/contexto-de-trozos
Nov 16, 2026
Merged

Consterna merged 1 commit into
mainfrom
feat/contexto-de-trozos

Conversation

@Consterna

Copy link
Copy Markdown
Owner

Segunda parte de la ola 7 del plan de calidad: frases partidas, con su contexto.

Qué cambia

  • Componentes JSON de estilos mezclados (["", {"text": "Use the "}, {"text": "Wrench", "color": "gold"}, …]): cada trozo se sigue traduciendo aparte, para no perder colores ni eventos, pero ahora lleva la frase entera en la pista («trozo de la frase «Use the Wrench to rotate blocks.»»). Lo aplica base.piezas_de en las misiones (FTB Quests en SNBT y en JSON, Heracles) y en los libros.
  • Líneas que no cierran su frase: una línea de una misión o de un libro que no termina en punto, signo o cierre («Right-click the block with») lleva también el comienzo de la siguiente («sigue con «…»»). Antes solo llevaba la anterior y el título. quitar_vecindad también quita esta parte, para las mediciones sin vecindad.

Por qué así y no traduciendo el bloque entero

Traducir la frase como plantilla y repartirla entre los trozos, o la descripción como un solo bloque, obliga a reescribir cómo se escriben los archivos. Además, si el modelo mueve los cortes, las líneas o los estilos quedan desalineados. La pista da el mismo contexto sin ese riesgo, igual que el contexto de la ola 4, que se midió y mejoró la interfaz.

Medición

Sin medición con el modelo: los bancos tienen sus pistas fijas y no traen componentes de varios trozos. Lo cubren las pruebas de tests/test_contexto_de_trozos.py.

Verificación

scripts/verificar.py completo: 1375 pruebas pasan.

…ntinuación

Cada trozo de un componente JSON de estilos mezclados se sigue traduciendo aparte, pero con la frase entera en la pista. Una línea de una misión o de un libro que no cierra su frase lleva el comienzo de la siguiente.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T02:01:15.635116Z 285f9ac PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 285f9accc8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

frase = " ".join("".join(trozos).split())
frase = frase if len(frase) <= LARGO_FRASE else frase[: LARGO_FRASE - 1] + "…"
extra = f"trozo de la frase «{frase}»"
return [Pieza(u, f"{pista} · {extra}" if pista else extra) for u in partes]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep styled titles identifiable as titles

When an FTB Quests title or book name/title is a multi-part JSON component, this suffix means the hint no longer ends with title or exactly equals libro: title. The title predicates then fail, so con_vecindad does not establish the right title context for following text and may carry over the previous title instead. Preserve the title-field identity separately from the component-context hint.

Useful? React with 👍 / 👎.

trozos = json_texto.extraer(texto, literal) or []
if len(partes) < 2 or len(trozos) < 2:
return [Pieza(u, pista) for u in partes]
frase = " ".join("".join(trozos).split())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude hover text from the visible phrase context

When a component has multiple visible text segments and a hoverEvent.show_text, json_texto.extraer also returns the tooltip text, so this concatenation treats it as part of the visible phrase (for example, combining a label with its tooltip). That unrelated phrase is then added as context to each chunk and can mislead their translations; build the context from the same rendered text run or keep hover text separate.

Useful? React with 👍 / 👎.

@Consterna
Consterna merged commit bf6b6e6 into main Nov 16, 2026
5 checks passed
@Consterna
Consterna deleted the feat/contexto-de-trozos branch November 16, 2026 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant