Skip to content

Commit c36138b

Browse files
translate some paragraphs in use server
1 parent 969f0ac commit c36138b

File tree

1 file changed

+37
-39
lines changed

1 file changed

+37
-39
lines changed

src/content/reference/rsc/use-server.md

Lines changed: 37 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
title: "'use server'"
3-
titleForTitleTag: "'use server' directive"
3+
titleForTitleTag: "'use server' direktif"
44
---
55

66
<RSC>
77

8-
`'use server'` is for use with [using React Server Components](/learn/start-a-new-react-project#bleeding-edge-react-frameworks).
8+
`'use server'`, [React Sunucu Bileşenleri kullanımı için](/learn/start-a-new-react-project#bleeding-edge-react-frameworks) kullanılır.
99

1010
</RSC>
1111

@@ -24,7 +24,7 @@ titleForTitleTag: "'use server' directive"
2424

2525
### `'use server'` {/*use-server*/}
2626

27-
Add `'use server'` at the top of an async function body to mark the function as callable by the client. We call these functions [_Server Functions_](/reference/rsc/server-functions).
27+
Bir async fonksiyonunun başına `'use server'` ekleyerek fonksiyonu istemci tarafından çağrılabilir hale getirin. Bu fonksiyonlara [_Server Functions_](/reference/rsc/server-functions) denir.
2828

2929
```js {2}
3030
async function addToCart(data) {
@@ -33,38 +33,38 @@ async function addToCart(data) {
3333
}
3434
```
3535

36-
When calling a Server Function on the client, it will make a network request to the server that includes a serialized copy of any arguments passed. If the Server Function returns a value, that value will be serialized and returned to the client.
36+
Bir Sunucu Fonksiyon'u istemciden çağırdığınızda, geçilen tüm argümanların serileştirilmiş bir kopyasını içeren bir ağ isteği sunucuya yapılır. Eğer Sunucu Fonksiyon bir değer dönerse, bu değer serileştirilir ve istemciye geri gönderilir.
3737

38-
Instead of individually marking functions with `'use server'`, you can add the directive to the top of a file to mark all exports within that file as Server Functions that can be used anywhere, including imported in client code.
38+
Fonksiyonları tek tek `'use server'` ile işaretlemek yerine, bir dosyanın başına yönergeyi ekleyebilirsiniz, böylece o dosyadaki tüm export'lar, istemci kodunda da kullanılabilen Sunucu Fonksiyon'lar olarak işaretlenir.
3939

40-
#### Caveats {/*caveats*/}
41-
* `'use server'` must be at the very beginning of their function or module; above any other code including imports (comments above directives are OK). They must be written with single or double quotes, not backticks.
42-
* `'use server'` can only be used in server-side files. The resulting Server Functions can be passed to Client Components through props. See supported [types for serialization](#serializable-parameters-and-return-values).
43-
* To import a Server Functions from [client code](/reference/rsc/use-client), the directive must be used on a module level.
44-
* Because the underlying network calls are always asynchronous, `'use server'` can only be used on async functions.
45-
* Always treat arguments to Server Functions as untrusted input and authorize any mutations. See [security considerations](#security).
46-
* Server Functions should be called in a [Transition](/reference/react/useTransition). Server Functions passed to [`<form action>`](/reference/react-dom/components/form#props) or [`formAction`](/reference/react-dom/components/input#props) will automatically be called in a transition.
47-
* Server Functions are designed for mutations that update server-side state; they are not recommended for data fetching. Accordingly, frameworks implementing Server Functions typically process one action at a time and do not have a way to cache the return value.
40+
#### Uyarılar {/*caveats*/}
41+
* `'use server'` fonksiyonlarının veya modüllerinin başında, diğer kodlardan (imports dahil) önce olmalıdır (yönergelerden önceki yorumlar kabul edilir). Tek tırnak veya çift tırnak ile yazılmalıdır, ters tırnak kullanılamaz.
42+
* `'use server'` yalnızca sunucu tarafı dosyalarında kullanılabilir. Ortaya çıkan Sunucu Fonksiyon'lar, Sunucu Bileşen'lere prop'lar aracılığıyla iletilebilir. Desteklenen [serileştirme türlerine](#serializable-parameters-and-return-values) bakın.
43+
* Bir Sunucu Fonksiyon'ı [istemci kodu](/reference/rsc/use-client) içinden içe aktarmak için, yönerge modül seviyesinde kullanılmalıdır.
44+
* Altta yatan ağ çağrıları her zaman asenkron olduğu için, `'use server'` yalnızca async fonksiyonlarda kullanılabilir.
45+
* Sunucu Fonksiyon'lara geçirilen argümanları her zaman güvenilmeyen girişler olarak ele alın ve herhangi bir değişiklik yapmadan önce yetkilendirme yapın. [Güvenlik önlemleri](#security) için bakın.
46+
* Sunucu Fonksiyon'lar bir [Transition](/reference/react/useTransition) içinde çağrılmalıdır. [`<form action>`](/reference/react-dom/components/form#props) veya [`formAction`](/reference/react-dom/components/input#props) ile geçirilen Sunucu Fonksiyon'lar otomatik olarak bir geçiş içinde çağrılacaktır.
47+
* Sunucu Fonksiyon'lar, sunucu tarafı durumu güncelleyen değişiklikler için tasarlanmıştır; veri çekme işlemleri için önerilmezler. Bu nedenle, Sunucu Fonksiyon'ları uygulayan framework'ler genellikle her seferinde bir işlemi işler ve dönüş değerini önbelleğe almak için bir yöntem sunmazlar.
4848

4949
### Güvenlikle ilgili hususlar {/*security*/}
5050

51-
Arguments to Server Functions are fully client-controlled. For security, always treat them as untrusted input, and make sure to validate and escape arguments as appropriate.
51+
Sunucu Fonksiyon'lara geçirilen argümanlar tamamen istemci tarafından kontrol edilir. Güvenlik için, her zaman bunları güvenilmeyen girişler olarak ele alın ve argümanları uygun şekilde doğrulayın ve kaçış işlemi uygulayın.
5252

53-
In any Server Function, make sure to validate that the logged-in user is allowed to perform that action.
53+
Herhangi bir Sunucu Fonksiyonu içinde, giriş yapmış kullanıcının bu işlemi gerçekleştirmeye yetkili olduğundan emin olun.
5454

5555
<Wip>
5656

57-
To prevent sending sensitive data from a Server Function, there are experimental taint APIs to prevent unique values and objects from being passed to client code.
57+
Bir Sunucu Fonksiyonun'dan hassas veri gönderimini önlemek için, istemci koduna benzersiz değerlerin ve nesnelerin iletilmesini engellemek amacıyla deneysel taint API'leri mevcuttur.
5858

5959
Bkz. [experimental_taintUniqueValue](/reference/react/experimental_taintUniqueValue) ve [experimental_taintObjectReference](/reference/react/experimental_taintObjectReference).
6060

6161
</Wip>
6262

6363
### Serileştirilebilir bağımsız değişkenler ve dönüş değerleri {/*serializable-parameters-and-return-values*/}
6464

65-
Since client code calls the Server Function over the network, any arguments passed will need to be serializable.
65+
İstemci kodu, Sunucu Fonksiyon'u ağ üzerinden çağırdığı için, geçirilen tüm argümanların serileştirilebilir olması gerekir.
6666

67-
Here are supported types for Server Function arguments:
67+
İşte Sunucu Fonksiyon argümanları için desteklenen türler:
6868

6969
* Primitives
7070
* [string](https://developer.mozilla.org/en-US/docs/Glossary/String)
@@ -83,29 +83,28 @@ Here are supported types for Server Function arguments:
8383
* [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date)
8484
* [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) instances
8585
* Plain [objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object): those created with [object initializers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer), with serializable properties
86-
* Functions that are Server Functions
86+
* Sunucu Fonksiyon'u olan fonksiyonlar
8787
* [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)
8888

89-
Notably, these are not supported:
90-
* React elements, or [JSX](/learn/writing-markup-with-jsx)
91-
* Functions, including component functions or any other function that is not a Server Function
92-
* [Classes](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Classes_in_JavaScript)
93-
* Objects that are instances of any class (other than the built-ins mentioned) or objects with [a null prototype](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object#null-prototype_objects)
94-
* Symbols not registered globally, ex. `Symbol('my new symbol')`
95-
* Events from event handlers
96-
89+
Özellikle, bunlar desteklenmez:
90+
* React elemanları veya [JSX](/learn/writing-markup-with-jsx)
91+
* Fonksiyonlar, bileşen fonksiyonları veya Sunucu Fonksiyon olmayan diğer tüm fonksiyonlar dahil
92+
* [Sınıflar](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/Classes_in_JavaScript)
93+
* Herhangi bir sınıfın örnekleri olan nesneler (bahsedilen yerleşik sınıflar dışında) veya [null prototipi olan nesneler](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object#null-prototype_objects)
94+
* Küresel olarak kaydedilmemiş semboller, örneğin `Symbol('my new symbol')`
95+
* Olay yöneticilerinden gelen olaylar
9796

9897
Desteklenen serileştirilebilir dönüş değerleri, bir sınır İstemci Bileşeni için [serileştirilebilir proplar](/reference/rsc/use-client#passing-props-from-server-to-client-components) ile aynıdır.
9998

10099
## Kullanım {/*usage*/}
101100

102101
### Formlarda Sunucu Eylemleri {/*server-actions-in-forms*/}
103102

104-
### Server Functions in forms {/*server-functions-in-forms*/}
103+
### Formlardaki Sunucu Fonksiyon'lar {/*server-functions-in-forms*/}
105104

106-
The most common use case of Server Functions will be calling functions that mutate data. On the browser, the [HTML form element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form) is the traditional approach for a user to submit a mutation. With React Server Components, React introduces first-class support for Server Functions as Actions in [forms](/reference/react-dom/components/form).
105+
Sunucu Fonksiyon'ların en yaygın kullanım senaryosu, veri üzerinde değişiklik yapan fonksiyonları çağırmaktır. Tarayıcıda, [HTML form elemanı](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form), bir kullanıcının bir değişiklik göndermesi için geleneksel yaklaşımdır. React Sunucu Bileşenleri ile React, [formlarda](/reference/react-dom/components/form) Sunucu Fonksiyon'lar için birinci sınıf destek sunar.
107106

108-
Here is a form that allows a user to request a username.
107+
İşte bir kullanıcının bir kullanıcı adı talep etmesine izin veren bir form.
109108

110109
```js [[1, 3, "formData"]]
111110
// App.js
@@ -126,15 +125,15 @@ export default function App() {
126125
}
127126
```
128127

129-
In this example `requestUsername` is a Server Function passed to a `<form>`. When a user submits this form, there is a network request to the server function `requestUsername`. When calling a Server Function in a form, React will supply the form's <CodeStep step={1}>[FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData)</CodeStep> as the first argument to the Server Function.
128+
Bu örnekte `requestUsername`, bir `<form>`'a geçirilen bir Sunucu Fonksiyon'dır. Bir kullanıcı bu formu gönderdiğinde, `requestUsername` sunucu fonksiyonuna yapılan bir ağ isteği gerçekleşir. Bir Sunucu Fonksiyon'ı form içinde çağırırken, React, formun <CodeStep step={1}>[FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData)</CodeStep>'sini birinci argüman olarak Sunucu Fonksiyon'a iletecektir.
130129

131-
By passing a Server Function to the form `action`, React can [progressively enhance](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement) the form. This means that forms can be submitted before the JavaScript bundle is loaded.
130+
Bir Sunucu Fonksiyon'ı form `action`'ına geçirerek, React formu [kademeli olarak iyileştirebilir](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement). Bu, formların JavaScript paketi yüklenmeden önce gönderilebileceği anlamına gelir.
132131

133132
#### Formlarda dönüş değerlerini işleme {/*handling-return-values*/}
134133

135134
Kullanıcı adı istek formunda, bir kullanıcı adının mevcut olmaması ihtimali olabilir. `requestUsername` bize başarısız olup olmadığını söylemelidir.
136135

137-
To update the UI based on the result of a Server Function while supporting progressive enhancement, use [`useActionState`](/reference/react/useActionState).
136+
Sunucu Fonksiyonu sonucuna dayalı olarak UI'yı güncellemek ve kademeli iyileştirmeyi desteklemek için, [`useActionState`](/reference/react/useActionState) kullanın.
138137

139138
```js
140139
// requestUsername.js
@@ -172,14 +171,13 @@ function UsernameForm() {
172171
}
173172
```
174173

175-
Note that like most Hooks, `useActionState` can only be called in <CodeStep step={1}>[client code](/reference/rsc/use-client)</CodeStep>.
176-
Çoğu Hook gibi `useActionState`in de yalnızca <CodeStep step={1}>[client code](/reference/rsc/use-client)</CodeStep> içinde çağrılabileceğini unutmayın.
174+
Not: Diğer çoğu Hook gibi `useActionState`in de yalnızca <CodeStep step={1}>[client code](/reference/rsc/use-client)</CodeStep> içinde çağrılabileceğini unutmayın.
177175

178-
### Calling a Server Function outside of `<form>` {/*calling-a-server-function-outside-of-form*/}
176+
### `<form>` dışında bir Sunucu Fonksiyon'u çağırma {/*calling-a-server-function-outside-of-form*/}
179177

180-
Server Functions are exposed server endpoints and can be called anywhere in client code.
178+
Sunucu Fonksiyon'lar, sunucu uç noktalarıdır ve istemci kodunda her yerde çağrılabilir.
181179

182-
When using a Server Function outside a [form](/reference/react-dom/components/form), call the Server Function in a [Transition](/reference/react/useTransition), which allows you to display a loading indicator, show [optimistic state updates](/reference/react/useOptimistic), and handle unexpected errors. Forms will automatically wrap Server Functions in transitions.
180+
Bir Sunucu Fonksiyon'u bir [form](/reference/react-dom/components/form) dışında kullanırken, Sunucu Fonksiyon'u bir [Transition](/reference/react/useTransition) içinde çağırın, bu sayede yükleme göstergesi gösterebilir, [iyimser durum güncellemeleri](/reference/react/useOptimistic) yapabilir ve beklenmeyen hataları yönetebilirsiniz. Formlar, otomatik olarak Sunucu Fonksiyon'ları geçişler içinde sarar.
183181

184182
```js {9-12}
185183
import incrementLike from './actions';
@@ -216,4 +214,4 @@ export default async function incrementLike() {
216214
}
217215
```
218216

219-
To read a Server Function return value, you'll need to `await` the promise returned.
217+
Bir Sunucu Fonksiyon dönüş değerini okumak için, döndürülen promise'i `await` etmeniz gerekecek.

0 commit comments

Comments
 (0)