Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translate error boundaries documentation to spanish #147

Merged
merged 4 commits into from
Feb 22, 2019

Conversation

jesgarciamartinez
Copy link
Contributor

Copy link
Member

@alejandronanez alejandronanez left a comment

Choose a reason for hiding this comment

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

👋 @jesgarciamartinez, welcome and thanks for your first contribution!

I say you split the paragraphs in different lines, can you please roll that back? I'd be easy for us to review and left comments and also (the most important reason) will help us to avoid nasty git merge conflicts in the future.

Also, you forgot to translate one paragraph.

Please, let me know if you need help with this! Happy to help!

Thanks,

permalink: docs/error-boundaries.html
---

In the past, JavaScript errors inside components used to corrupt React’s internal state and cause it to [emit](https://github.com/facebook/react/issues/4026) [cryptic](https://github.com/facebook/react/issues/6895) [errors](https://github.com/facebook/react/issues/8579) on next renders. These errors were always caused by an earlier error in the application code, but React did not provide a way to handle them gracefully in components, and could not recover from them.
En el pasado, los errores de JavaScript dentro de los componentes solían corromper el estado interno de React y
hacían que [emitiera](https://github.com/facebook/react/issues/4026) [errores](https://github.com/facebook/react/issues/6895) [crípticos](https://github.com/facebook/react/issues/8579) en siguientes renderizados.
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep this in the same line ( line # 7 )


## Introducing Error Boundaries {#introducing-error-boundaries}
Un error de JavaScript en una parte de la interfaz no debería romper toda la aplicación.
Para resolver este problema, React 16 introduce el nuevo concepto de “límite de errores”.
Copy link
Member

Choose a reason for hiding this comment

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

Also, let's merge line 14 and 15.


A JavaScript error in a part of the UI shouldn’t break the whole app. To solve this problem for React users, React 16 introduces a new concept of an “error boundary”.
Los límites de errores son componentes de React que **capturan errores de JavaScript en cualquier parte
Copy link
Member

Choose a reason for hiding this comment

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

Please, let's merge lines 17-20 into one line.


A class component becomes an error boundary if it defines either (or both) of the lifecycle methods [`static getDerivedStateFromError()`](/docs/react-component.html#static-getderivedstatefromerror) or [`componentDidCatch()`](/docs/react-component.html#componentdidcatch). Use `static getDerivedStateFromError()` to render a fallback UI after an error has been thrown. Use `componentDidCatch()` to log error information.
Un componente de clase (class component) se convierte en límite de errores si define
Copy link
Member

Choose a reason for hiding this comment

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

Please merge 31 - 34.


```js
<ErrorBoundary>
<MyWidget />
</ErrorBoundary>
```

Error boundaries work like a JavaScript `catch {}` block, but for components. Only class components can be error boundaries. In practice, most of the time you’ll want to declare an error boundary component once and use it throughout your application.
Los límites de errores funcionan como un bloque catch{} de JavaScript, pero para componentes. Sólo los componentes
Copy link
Member

Choose a reason for hiding this comment

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

Merge 72 - 74


```js
<Button />
```

Error boundaries preserve the declarative nature of React, and behave as you would expect. For example, even if an error occurs in a `componentDidUpdate` method caused by a `setState` somewhere deep in the tree, it will still correctly propagate to the closest error boundary.
Los límites de errores preservan la naturaleza declarativa de React, y se comportan como esperarías.
Copy link
Member

Choose a reason for hiding this comment

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

Merge 145-147

Error boundaries preserve the declarative nature of React, and behave as you would expect. For example, even if an error occurs in a `componentDidUpdate` method caused by a `setState` somewhere deep in the tree, it will still correctly propagate to the closest error boundary.
Los límites de errores preservan la naturaleza declarativa de React, y se comportan como esperarías.
Por ejemplo, incluso si un error ocurre en un método `componentDidUpdate` causado por un `setState` en algún sitio
profundamente dentro del árbol, se propagará de todas formas correctamente al límite de errores más cercano.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
profundamente dentro del árbol, se propagará de todas formas correctamente al límite de errores más cercano.
profundo dentro del árbol, se propagará de todas formas correctamente al límite de errores más cercano.


Error boundaries **do not** catch errors inside event handlers.
Los límites de errores **no** capturan errores en los manejadores de eventos

React doesn't need error boundaries to recover from errors in event handlers. Unlike the render method and lifecycle methods, the event handlers don't happen during rendering. So if they throw, React still knows what to display on the screen.
Copy link
Member

Choose a reason for hiding this comment

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

This still needs a translation!


React doesn't need error boundaries to recover from errors in event handlers. Unlike the render method and lifecycle methods, the event handlers don't happen during rendering. So if they throw, React still knows what to display on the screen.

If you need to catch an error inside event handler, use the regular JavaScript `try` / `catch` statement:
React no necesita límites de errores para recuperarse de errores en los manejadores de eventos.
Copy link
Member

Choose a reason for hiding this comment

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

Also, make this one line please.


React 15 included a very limited support for error boundaries under a different method name: `unstable_handleError`. This method no longer works, and you will need to change it to `componentDidCatch` in your code starting from the first 16 beta release.
React 15 incluía un soporte muy limitado para límites de errores con un nombre de método diferente:
Copy link
Member

Choose a reason for hiding this comment

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

Also, make this one line.

@netlify
Copy link

netlify bot commented Feb 21, 2019

Deploy preview for es-reactjs ready!

Built with commit a5a3745

https://deploy-preview-147--es-reactjs.netlify.com

@jesgarciamartinez
Copy link
Contributor Author

Hi @alejandronanez, I just uploaded the requested changes. I think the formatting is fine now, and I removed the leftover english paragraph (it was actually translated in the next line).
Do tell me if you need me to change anything else.
Thank you!

alejandronanez and others added 2 commits February 21, 2019 21:31
…s.md

Co-Authored-By: jesgarciamartinez <jes.garcia.martinez@gmail.com>
Copy link
Member

@alejandronanez alejandronanez left a comment

Choose a reason for hiding this comment

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

thanks for all the hard work @jesgarciamartinez

@alejandronanez alejandronanez merged commit eec2737 into reactjs:master Feb 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants