From c6c6dfd9746161dff85d5b85eb924853f85174cc Mon Sep 17 00:00:00 2001 From: adifsgaid Date: Mon, 5 Jul 2021 10:30:22 +0200 Subject: [PATCH 1/5] Translation in a IDEOMATICALY way, for the page FAQ APIs and AJAX #79 --- content/docs/faq-ajax.md | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/content/docs/faq-ajax.md b/content/docs/faq-ajax.md index 445d1d0ac..891a10e04 100644 --- a/content/docs/faq-ajax.md +++ b/content/docs/faq-ajax.md @@ -6,19 +6,19 @@ layout: docs category: FAQ --- -### How can I make an AJAX call? {#how-can-i-make-an-ajax-call} +### Come posso fare una chiamata AJAX ? {#come-posso-fare-una-chiamata-ajax} -You can use any AJAX library you like with React. Some popular ones are [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/), and the browser built-in [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). +Puoi usare qualsiasi libreria AJAX con React. Le piu popolari sono [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/), e il e il browser integrato [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). -### Where in the component lifecycle should I make an AJAX call? {#where-in-the-component-lifecycle-should-i-make-an-ajax-call} +### In quale punto del ciclo di vita del componente devo effettuare una chiamata AJAX? {#dove-nel-ciclo-di-vita-del-componente-dovrei-fare-una-chiamata-ajax} -You should populate data with AJAX calls in the [`componentDidMount`](/docs/react-component.html#mounting) lifecycle method. This is so you can use `setState` to update your component when the data is retrieved. +Dovresti popolare i dati con chiamate AJAX nel metodo [`componentDidMount`](/docs/react-component.html#mounting). In questo modo puoi usare `setState` per aggiornare il tuo componente quando i dati vengono recuperati. -### Example: Using AJAX results to set local state {#example-using-ajax-results-to-set-local-state} +### Esempio: utilizzo dei risultati AJAX per impostare lo stato locale {#esempio-usando-ajax-risultati-impostare-lo-stato-locale} -The component below demonstrates how to make an AJAX call in `componentDidMount` to populate local component state. +Il componente seguente mostra come effettuare una chiamata AJAX in `componentDidMount` per popolare lo stato del componente locale. -The example API returns a JSON object like this: +L'API in questione restituisce un oggetto JSON di questo formato: ``` { @@ -50,9 +50,9 @@ class MyComponent extends React.Component { items: result.items }); }, - // Note: it's important to handle errors here - // instead of a catch() block so that we don't swallow - // exceptions from actual bugs in components. + // Nota: è importante gestire gli errori qui + // invece di un blocco catch() in modo da non fare passare + // eccezioni da bug reali nei componenti. (error) => { this.setState({ isLoaded: true, @@ -83,7 +83,7 @@ class MyComponent extends React.Component { } ``` -Here is the equivalent with [Hooks](https://reactjs.org/docs/hooks-intro.html): +Ecco l'equivalente con [Hooks](https://reactjs.org/docs/hooks-intro.html): ```js function MyComponent() { @@ -91,9 +91,10 @@ function MyComponent() { const [isLoaded, setIsLoaded] = useState(false); const [items, setItems] = useState([]); - // Note: the empty deps array [] means - // this useEffect will run once - // similar to componentDidMount() + + // Nota: l'array deps vuoto [] significa + // questo useEffect verrà eseguito una volta + // simile a componentDidMount() useEffect(() => { fetch("https://api.example.com/items") .then(res => res.json()) @@ -102,9 +103,9 @@ function MyComponent() { setIsLoaded(true); setItems(result); }, - // Note: it's important to handle errors here - // instead of a catch() block so that we don't swallow - // exceptions from actual bugs in components. + // Nota: è importante gestire gli errori qui + // invece di un blocco catch() in modo da non fare passare + // eccezioni da bug reali nei componenti. (error) => { setIsLoaded(true); setError(error); From 83504d2da0e6eed2be0eaebcc4df7d43da2009ea Mon Sep 17 00:00:00 2001 From: adifsgaid Date: Fri, 9 Jul 2021 13:34:42 +0200 Subject: [PATCH 2/5] ID delle intestazioni in lingua originale --- content/docs/faq-ajax.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/content/docs/faq-ajax.md b/content/docs/faq-ajax.md index 891a10e04..e53ee8bfc 100644 --- a/content/docs/faq-ajax.md +++ b/content/docs/faq-ajax.md @@ -50,9 +50,9 @@ class MyComponent extends React.Component { items: result.items }); }, - // Nota: è importante gestire gli errori qui - // invece di un blocco catch() in modo da non fare passare - // eccezioni da bug reali nei componenti. + // Note: it's important to handle errors here + // instead of a catch() block so that we don't swallow + // exceptions from actual bugs in components. (error) => { this.setState({ isLoaded: true, @@ -92,9 +92,9 @@ function MyComponent() { const [items, setItems] = useState([]); - // Nota: l'array deps vuoto [] significa - // questo useEffect verrà eseguito una volta - // simile a componentDidMount() + // Note: the empty deps array [] means + // this useEffect will run once + // similar to componentDidMount() useEffect(() => { fetch("https://api.example.com/items") .then(res => res.json()) @@ -103,9 +103,9 @@ function MyComponent() { setIsLoaded(true); setItems(result); }, - // Nota: è importante gestire gli errori qui - // invece di un blocco catch() in modo da non fare passare - // eccezioni da bug reali nei componenti. + // Note: it's important to handle errors here + // instead of a catch() block so that we don't swallow + // exceptions from actual bugs in components. (error) => { setIsLoaded(true); setError(error); From 1b4cf9790f44b8ee275959dd1c8dd0e043bb67a1 Mon Sep 17 00:00:00 2001 From: adifsgaid Date: Wed, 14 Jul 2021 11:22:30 +0200 Subject: [PATCH 3/5] Traduzione ID in linguar ORIGINALE --- content/docs/faq-ajax.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/content/docs/faq-ajax.md b/content/docs/faq-ajax.md index e53ee8bfc..e34d4cff1 100644 --- a/content/docs/faq-ajax.md +++ b/content/docs/faq-ajax.md @@ -6,15 +6,15 @@ layout: docs category: FAQ --- -### Come posso fare una chiamata AJAX ? {#come-posso-fare-una-chiamata-ajax} +### Come posso fare una chiamata AJAX ? {#how-can-i-make-an-ajax-call} Puoi usare qualsiasi libreria AJAX con React. Le piu popolari sono [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/), e il e il browser integrato [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). -### In quale punto del ciclo di vita del componente devo effettuare una chiamata AJAX? {#dove-nel-ciclo-di-vita-del-componente-dovrei-fare-una-chiamata-ajax} +### In quale punto del ciclo di vita del componente devo effettuare una chiamata AJAX? {#where-in-the-component-lifecycle-should-i-make-an-ajax-call} Dovresti popolare i dati con chiamate AJAX nel metodo [`componentDidMount`](/docs/react-component.html#mounting). In questo modo puoi usare `setState` per aggiornare il tuo componente quando i dati vengono recuperati. -### Esempio: utilizzo dei risultati AJAX per impostare lo stato locale {#esempio-usando-ajax-risultati-impostare-lo-stato-locale} +### Esempio: utilizzo dei risultati AJAX per impostare lo stato locale {#example-using-ajax-results-to-set-local-state} Il componente seguente mostra come effettuare una chiamata AJAX in `componentDidMount` per popolare lo stato del componente locale. @@ -50,9 +50,9 @@ class MyComponent extends React.Component { items: result.items }); }, - // Note: it's important to handle errors here - // instead of a catch() block so that we don't swallow - // exceptions from actual bugs in components. + // Nota: è importante gestire gli errori qui + // invece di un blocco catch() in modo da non fare passare + // eccezioni da bug reali nei componenti. (error) => { this.setState({ isLoaded: true, @@ -92,9 +92,9 @@ function MyComponent() { const [items, setItems] = useState([]); - // Note: the empty deps array [] means - // this useEffect will run once - // similar to componentDidMount() + // Nota: l'array deps vuoto [] significa + // questo useEffect verrà eseguito una volta + // simile a componentDidMount() useEffect(() => { fetch("https://api.example.com/items") .then(res => res.json()) @@ -103,9 +103,9 @@ function MyComponent() { setIsLoaded(true); setItems(result); }, - // Note: it's important to handle errors here - // instead of a catch() block so that we don't swallow - // exceptions from actual bugs in components. + // Nota: è importante gestire gli errori qui + // invece di un blocco catch() in modo da non fare passare + // eccezioni da bug reali nei componenti. (error) => { setIsLoaded(true); setError(error); From 3e0f1bb8d2b47a446120c25223f6aec6d24b23f6 Mon Sep 17 00:00:00 2001 From: Adif Sgaid <69080239+adifsgaid@users.noreply.github.com> Date: Mon, 19 Jul 2021 10:32:26 +0200 Subject: [PATCH 4/5] Update content/docs/faq-ajax.md Co-authored-by: Alessandro De Blasis --- content/docs/faq-ajax.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/faq-ajax.md b/content/docs/faq-ajax.md index e34d4cff1..64a8ff319 100644 --- a/content/docs/faq-ajax.md +++ b/content/docs/faq-ajax.md @@ -8,7 +8,7 @@ category: FAQ ### Come posso fare una chiamata AJAX ? {#how-can-i-make-an-ajax-call} -Puoi usare qualsiasi libreria AJAX con React. Le piu popolari sono [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/), e il e il browser integrato [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). +Puoi usare qualsiasi libreria AJAX con React. Le più popolari sono [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/), e l'API [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) che è integrata nel browser. ### In quale punto del ciclo di vita del componente devo effettuare una chiamata AJAX? {#where-in-the-component-lifecycle-should-i-make-an-ajax-call} From b5d53003ca74d879513c46ceb174b73f5e37c4f7 Mon Sep 17 00:00:00 2001 From: adifsgaid Date: Mon, 19 Jul 2021 10:35:41 +0200 Subject: [PATCH 5/5] correzione --- content/docs/faq-ajax.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/docs/faq-ajax.md b/content/docs/faq-ajax.md index e34d4cff1..64a8ff319 100644 --- a/content/docs/faq-ajax.md +++ b/content/docs/faq-ajax.md @@ -8,7 +8,7 @@ category: FAQ ### Come posso fare una chiamata AJAX ? {#how-can-i-make-an-ajax-call} -Puoi usare qualsiasi libreria AJAX con React. Le piu popolari sono [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/), e il e il browser integrato [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). +Puoi usare qualsiasi libreria AJAX con React. Le più popolari sono [Axios](https://github.com/axios/axios), [jQuery AJAX](https://api.jquery.com/jQuery.ajax/), e l'API [window.fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) che è integrata nel browser. ### In quale punto del ciclo di vita del componente devo effettuare una chiamata AJAX? {#where-in-the-component-lifecycle-should-i-make-an-ajax-call}