Skip to content

Translate 'Bubbling and capturing' to Portuguese - #511

Open
diogoosz wants to merge 3 commits into
javascript-tutorial:masterfrom
diogoosz:translate-bubbling-and-capturing
Open

diogoosz wants to merge 3 commits into
javascript-tutorial:masterfrom
diogoosz:translate-bubbling-and-capturing

Conversation

@diogoosz

@diogoosz diogoosz commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Resumo

Traduz o artigo "Bubbling and capturing" para o português.

Traduzi os rótulos em prosa de event-order-bubbling.svg e eventflow.svg (o diagrama das fases de captura/destino/bubbling tirado diretamente da especificação do W3C) via images.yml + pipeline do gulp. Mantive sem tradução os nomes de tags, a letra da música de exemplo e os nomes de modos musicais (Aeolian/Dorian) usados no exemplo da própria especificação. As demos capture.view/both.view/bubble-target.view não têm mais nenhum texto traduzível além do já ajustado.

"Bubbling" e "capturing" foram mantidos como termos técnicos em inglês já estabelecidos na prosa, consistente com o uso comum da comunidade dev em PT-BR.

Conforme comentado na #1 (um PR anterior, #441 de @Silas310, foi fechado sem merge - retomando o trabalho).

Plano de teste

  • Diff de todos os trechos de código (code spans) entre o original em inglês e a tradução.
  • Grep em busca de falsos cognatos conhecidos e registro informal.
  • Confirmação de que apenas os 2 SVGs passados pelo pipeline foram alterados (git diff --stat -- '*.svg').
  • Releitura manual completa para checar sentido e concordância.

Translates the prose labels in event-order-bubbling.svg and eventflow.svg
(the W3C spec's own capturing/target/bubbling phase diagram) via
images.yml + gulp pipeline, keeping tag names, song lyrics and musical
mode names (Aeolian/Dorian) from the spec's example untouched. The
capture.view/both.view/bubble-target.view demos have no other
translatable prose. "Bubbling" and "capturing" are kept as established
English technical terms in the prose, consistent with common PT-BR
dev usage.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="353" height="216" viewBox="0 0 353 216"><defs><style>@import url(https://fonts.googleapis.com/css?family=Open+Sans:bold,italic,bolditalic%7CPT+Mono);@font-face{font-family:&apos;PT Mono&apos;;font-weight:700;font-style:normal;src:local(&apos;PT MonoBold&apos;),url(/font/PTMonoBold.woff2) format(&apos;woff2&apos;),url(/font/PTMonoBold.woff) format(&apos;woff&apos;),url(/font/PTMonoBold.ttf) format(&apos;truetype&apos;)}</style></defs><g id="dom" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><g id="event-order-bubbling.svg"><path id="Rectangle-210" fill="#DBAF88" d="M159.488 140L174 186H60l14.512-46z"/><path id="Rectangle-209" stroke="#91C2A3" stroke-width="18" d="M173.634 81l16.09 51H43.276l16.09-51h114.267z"/><path id="Rectangle-208" stroke="#EFA39F" stroke-width="18" d="M193.014 29l22.71 72H17.276l22.71-72h153.028z"/><path id="Fill-46" fill="#166388" d="M121.5 141v13.816a4.5 4.5 0 11-9 0V141h9zm0-31v13h-9v-13h9zM117 20.53a4.471 4.471 0 013.362 1.3l17.64 17.64a4.5 4.5 0 01-6.364 6.364L121.5 35.698V92h-9V35.7l-10.138 10.136a4.5 4.5 0 11-6.363-6.364l17.639-17.64a4.477 4.477 0 013.363-1.3z"/><text id="1" fill="#643B0C" font-family="PTMono-Bold, PT Mono" font-size="14" font-weight="bold"><tspan x="210" y="105">1</tspan></text><text id="2" fill="#643B0C" font-family="PTMono-Bold, PT Mono" font-size="14" font-weight="bold"><tspan x="185" y="136">2</tspan></text><text id="3" fill="#C06334" font-family="PTMono-Bold, PT Mono" font-size="14" font-weight="bold"><tspan x="157" y="181">3</tspan></text><text id="Most-deeply-nested-e" fill="#AF6E24" font-family="OpenSans-Bold, Open Sans" font-size="14" font-weight="bold"><tspan x="233.48" y="175">Most deeply</tspan> <tspan x="221.306" y="194">nested element</tspan></text><path id="Line-30" stroke="#C06334" stroke-dasharray="3,6" stroke-linecap="square" stroke-width="2" d="M179.5 177.5h30"/></g></g></svg> No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" width="353" height="216" viewBox="0 0 353 216"><defs><style>@import url(https://fonts.googleapis.com/css?family=Open+Sans:bold,italic,bolditalic%7CPT+Mono);@font-face{font-family:&apos;PT Mono&apos;;font-weight:700;font-style:normal;src:local(&apos;PT MonoBold&apos;),url(/font/PTMonoBold.woff2) format(&apos;woff2&apos;),url(/font/PTMonoBold.woff) format(&apos;woff&apos;),url(/font/PTMonoBold.ttf) format(&apos;truetype&apos;)}</style></defs><g id="dom" fill="none" fill-rule="evenodd" stroke="none" stroke-width="1"><g id="event-order-bubbling.svg"><path id="Rectangle-210" fill="#DBAF88" d="M159.488 140L174 186H60l14.512-46z"/><path id="Rectangle-209" stroke="#91C2A3" stroke-width="18" d="M173.634 81l16.09 51H43.276l16.09-51h114.267z"/><path id="Rectangle-208" stroke="#EFA39F" stroke-width="18" d="M193.014 29l22.71 72H17.276l22.71-72h153.028z"/><path id="Fill-46" fill="#166388" d="M121.5 141v13.816a4.5 4.5 0 11-9 0V141h9zm0-31v13h-9v-13h9zM117 20.53a4.471 4.471 0 013.362 1.3l17.64 17.64a4.5 4.5 0 01-6.364 6.364L121.5 35.698V92h-9V35.7l-10.138 10.136a4.5 4.5 0 11-6.363-6.364l17.639-17.64a4.477 4.477 0 013.363-1.3z"/><text id="1" fill="#643B0C" font-family="PTMono-Bold, PT Mono" font-size="14" font-weight="bold"><tspan x="210" y="105">1</tspan></text><text id="2" fill="#643B0C" font-family="PTMono-Bold, PT Mono" font-size="14" font-weight="bold"><tspan x="185" y="136">2</tspan></text><text id="3" fill="#C06334" font-family="PTMono-Bold, PT Mono" font-size="14" font-weight="bold"><tspan x="157" y="181">3</tspan></text><text id="Most-deeply-nested-e" fill="#AF6E24" font-family="OpenSans-Bold, Open Sans" font-size="14" font-weight="bold"><tspan x="224.48" y="175">Elemento mais</tspan> <tspan x="186.306" y="194">profundamente aninhado</tspan></text><path id="Line-30" stroke="#C06334" stroke-dasharray="3,6" stroke-linecap="square" stroke-width="2" d="M179.5 177.5h30"/></g></g></svg> No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Importante: os arquivos SVG não devem ser editados diretamente. Pelas diretrizes de tradução do projeto, as imagens ficam com o texto original em inglês e a tradução é aplicada automaticamente a partir do images.yml, e as entradas que você adicionou lá já cumprem esse papel.

Com o texto já trocado dentro do SVG, as chaves do images.yml ("Most deeply", "nested element") deixam de ser encontradas, e as próximas atualizações vindas do repositório em inglês vão gerar conflitos neste arquivo.

Sugestão: desfazer as alterações neste arquivo e também em eventflow.svg, mantendo apenas as entradas no images.yml.

Comment thread images.yml
"Target":
text: "Destino"
position: left
"Phase":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Importante: na imagem, cada legenda de fase ocupa duas linhas ("Target" / "Phase", "Capture" / "Phase", "Bubbling" / "Phase"). Traduzindo palavra por palavra, o resultado fica "Destino Fase (2)", "Captura Fase (1)" e "Propagação Fase (3)", com a ordem invertida para o português.

Como "Phase" é uma única chave usada nas três legendas, uma possibilidade é colocar o nome completo já na primeira linha ("Fase de destino", "Fase de captura" etc.) e deixar "Phase" com texto vazio, se a ferramenta do images.yml permitir. Vale conferir como a imagem fica depois de gerada.

Comment thread images.yml
"Capture":
text: "Captura"
position: left
"Bubbling":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Importante: no artigo o termo foi mantido como "bubbling" ("fase de bubbling"), mas aqui a legenda virou "Propagação". Além da inconsistência, "propagação" é o nome do processo completo, que inclui as três fases: o próprio texto fala em "3 fases de propagação de eventos", e o método se chama stopPropagation. Assim, a legenda passa a dizer algo diferente do original.

Sugestão: usar "Bubbling", como no restante do artigo.

Comment thread images.yml
"Most deeply":
text: "Elemento mais"
position: center
"nested element":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Importante: "profundamente aninhado" é bem mais longo que "nested element" e não cabe na imagem. Com fonte de 14px em negrito, o texto passa da largura de 353px do SVG e fica cortado na borda direita.

Sugestão: um texto mais curto, como "Elemento mais" / "aninhado", que também combina com o resumo do artigo ("o elemento mais aninhado").

Comment thread images.yml Outdated
text: "profundamente aninhado"
position: center
eventflow.svg:
"Window":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sugestão (opcional): "Window" e "Document" representam os objetos window e document, que no artigo continuam com os nomes originais (por exemplo, "até o objeto document"). Com "Janela" e "Documento", o leitor pode não associar o diagrama a esses objetos.

Sugestão: remover essas duas entradas e manter os nomes originais na imagem.

- Then the event moves down from the document root to `event.target`, calling handlers assigned with `addEventListener(..., true)` on the way (`true` is a shorthand for `{capture: true}`).
- Then handlers are called on the target element itself.
- Then the event bubbles up from `event.target` to the root, calling handlers assigned using `on<event>`, HTML attributes and `addEventListener` without the 3rd argument or with the 3rd argument `false/{capture:false}`.
- Então o evento se move do raiz do documento para baixo até `event.target`, chamando os manipuladores atribuídos com `addEventListener(..., true)` pelo caminho (`true` é uma forma abreviada de `{capture: true}`).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sugestão (opcional): pequeno erro de concordância: "raiz" é feminino, então o certo é "da raiz" (como já aparece na linha 217, "até a raiz").

Suggested change
- Então o evento se move do raiz do documento para baixo até `event.target`, chamando os manipuladores atribuídos com `addEventListener(..., true)` pelo caminho (`true` é uma forma abreviada de `{capture: true}`).
- Então o evento se move da raiz do documento para baixo até `event.target`, chamando os manipuladores atribuídos com `addEventListener(..., true)` pelo caminho (`true` é uma forma abreviada de `{capture: true}`).


1. `HTML` -> `BODY` -> `FORM` -> `DIV -> P` (capturing phase, the first listener):
2. `P` -> `DIV` -> `FORM` -> `BODY` -> `HTML` (bubbling phase, the second listener).
1. `HTML` -> `BODY` -> `FORM` -> `DIV -> P` (fase de captura, o primeiro listener):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sugestão (opcional): a palavra "listener" ficou sem tradução aqui e também nas linhas 185, 187 ("dois listeners") e 195 (título do bloco "Listeners no mesmo elemento..."). O restante do artigo já usa "manipulador".

Sugestão: "ouvinte", ou simplesmente "manipulador" para manter um só termo ao longo do texto.

Note que `P` aparece duas vezes, porque definimos dois listeners: captura e bubbling. O destino é acionado no final da primeira fase e no início da segunda.

There's a property `event.eventPhase` that tells us the number of the phase on which the event was caught. But it's rarely used, because we usually know it in the handler.
Há uma propriedade `event.eventPhase` que nos diz o número da fase em que o evento foi capturado. Mas ela é raramente usada, porque geralmente já a conhecemos no manipulador.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sugestão (opcional): "o evento foi capturado" pode confundir, porque neste artigo "captura" é o nome de uma fase específica. O original diz apenas em qual fase o evento foi recebido, que pode ser qualquer uma das três.

Sugestão: "o número da fase em que o evento foi tratado" (ou "recebido"). O mesmo cuidado vale para "capturar" nas linhas 67 e 112, onde "interceptar" ou "receber" evitaria a ambiguidade.

@@ -1,24 +1,24 @@
# Bubbling and capturing
# Bubbling e capturing

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sugestão (opcional): o título mantém "capturing" em inglês, mas no corpo do artigo o termo usado é "captura" ("fase de captura"). Para manter a consistência, sugiro "# Bubbling e captura", e o mesmo na última frase do artigo (linha 233, "Bubbling e capturing são a base...").

- Revert hand-edited SVGs (event-order-bubbling.svg, eventflow.svg)
  to their pristine English originals; translation must go through
  images.yml only, or future upstream syncs will conflict
- Fix images.yml: shorten the overflowing "nested element" label,
  keep "Window"/"Document" untranslated since the article refers to
  those objects by their original names, and restructure the
  two-line phase captions so the full phrase reads correctly in
  Portuguese ("Fase de destino" instead of "Destino"+"Fase")
- Keep "Bubbling" as the loanword used throughout the article instead
  of "Propagação", which names the whole process (stopPropagation),
  not just one phase
- Use "Bubbling e captura" consistently in the title and summary
  instead of mixing in the English "capturing"
- Translate "listener" as "manipulador" for consistency
- Fix "foi capturado" ambiguity (reads as the capture phase) and two
  uses of "capturar" that meant "intercept"/"receive", not the
  capturing phase specifically
- Fix gender agreement: "da raiz" (raiz is feminine)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@diogoosz

Copy link
Copy Markdown
Contributor Author

Obrigado pela revisão detalhada, @gabifs! Corrigido:

  • Revertidos event-order-bubbling.svg e eventflow.svg para o original em inglês; a tradução agora passa só pelo images.yml, regenerado via pipeline
  • "nested element" encurtado no images.yml pra não sobrepor o texto na imagem
  • "Window"/"Document" mantidos sem tradução no diagrama, já que o artigo referencia esses objetos pelos nomes originais
  • Legendas de fase reestruturadas ("Fase de destino", "Fase de captura", "Fase de bubbling"), com "Phase" ficando vazio
  • "Bubbling" mantido como no resto do artigo, em vez de "Propagação"
  • Título e resumo usando "Bubbling e captura" de forma consistente com o corpo do artigo
  • "listener" trocado por "manipulador"
  • "foi capturado" e dois usos de "capturar" trocados pra evitar ambiguidade com a fase de captura
  • Concordância de gênero: "da raiz" (raiz é feminino)

@gabifs

gabifs commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Obrigado pelas correções, @diogoosz! Ficou muito bom.

Só um detalhe sobre os SVGs: conferi e event-order-bubbling.svg e eventflow.svg ainda estão com os textos em português ("Elemento mais", "aninhado", "Fase de destino", etc.), ou seja, não voltaram para a versão original da master.

No repositório, os arquivos .svg ficam sempre em inglês e a tradução é aplicada só a partir do images.yml. Mesmo que o conteúdo seja igual ao gerado pelo processo, manter o SVG alterado causa conflito na próxima sincronização com o repositório em inglês.

Pode restaurar os dois arquivos a partir da master? Algo como:

git checkout <remoto-do-repositório-principal>/master -- 2-ui/2-events/02-bubbling-and-capturing/event-order-bubbling.svg 2-ui/2-events/02-bubbling-and-capturing/eventflow.svg

As entradas novas no images.yml estão ótimas e podem continuar como estão.

Per gabifs: SVG files always stay in English in the repo; translation
is applied only from images.yml, never by committing a translated
file (even one generated by the figuresTranslate pipeline). The
images.yml entries added earlier stay as-is.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
diogoosz added a commit to diogoosz/pt.javascript.info that referenced this pull request Nov 22, 2026
Per gabifs (on PR javascript-tutorial#505/javascript-tutorial#511, same rule applies here): SVG files in
the repo always stay identical to the English upstream; translation
is applied only from images.yml, never by committing a translated
file, whether hand-edited or generated by the figuresTranslate
pipeline. This includes two files (metric-client-left-top.svg,
metric-client-left-top-rtl.svg) that had been committed translated
since before this round of fixes. All images.yml entries, including
the label-width fixes from the previous commit, stay as-is.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@diogoosz

Copy link
Copy Markdown
Contributor Author

Feito, @gabifs! Restaurei os dois SVGs (event-order-bubbling.svg, eventflow.svg) a partir da master. As entradas no images.yml ficaram como estavam.

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.

2 participants