Skip to content

Commit 77316df

Browse files
Translate gating.md to Brazilian Portuguese
1 parent 630bc3f commit 77316df

File tree

1 file changed

+34
-34
lines changed
  • src/content/reference/react-compiler

1 file changed

+34
-34
lines changed

src/content/reference/react-compiler/gating.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: gating
44

55
<Intro>
66

7-
The `gating` option enables conditional compilation, allowing you to control when optimized code is used at runtime.
7+
A opção `gating` habilita a compilação condicional, permitindo que você controle quando o código otimizado é usado em tempo de execução.
88

99
</Intro>
1010

@@ -21,13 +21,13 @@ The `gating` option enables conditional compilation, allowing you to control whe
2121

2222
---
2323

24-
## Reference {/*reference*/}
24+
## Referência {/*reference*/}
2525

2626
### `gating` {/*gating*/}
2727

28-
Configures runtime feature flag gating for compiled functions.
28+
Configura o gating de feature flag em tempo de execução para funções compiladas.
2929

30-
#### Type {/*type*/}
30+
#### Tipo {/*type*/}
3131

3232
```
3333
{
@@ -36,38 +36,38 @@ Configures runtime feature flag gating for compiled functions.
3636
} | null
3737
```
3838

39-
#### Default value {/*default-value*/}
39+
#### Valor padrão {/*default-value*/}
4040

4141
`null`
4242

43-
#### Properties {/*properties*/}
43+
#### Propriedades {/*properties*/}
4444

45-
- **`source`**: Module path to import the feature flag from
46-
- **`importSpecifierName`**: Name of the exported function to import
45+
- **`source`**: Caminho do módulo para importar o feature flag.
46+
- **`importSpecifierName`**: Nome da função exportada a ser importada.
4747

48-
#### Caveats {/*caveats*/}
48+
#### Ressalvas {/*caveats*/}
4949

50-
- The gating function must return a boolean
51-
- Both compiled and original versions increase bundle size
52-
- The import is added to every file with compiled functions
50+
- A função de gating deve retornar um booleano.
51+
- Tanto a versão compilada quanto a original aumentam o tamanho do bundle.
52+
- A importação é adicionada a todos os arquivos com funções compiladas.
5353

5454
---
5555

56-
## Usage {/*usage*/}
56+
## Uso {/*usage*/}
5757

58-
### Basic feature flag setup {/*basic-setup*/}
58+
### Configuração básica de feature flag {/*basic-setup*/}
5959

60-
1. Create a feature flag module:
60+
1. Crie um módulo de feature flag:
6161

6262
```js
6363
// src/utils/feature-flags.js
6464
export function shouldUseCompiler() {
65-
// your logic here
65+
// sua lógica aqui
6666
return getFeatureFlag('react-compiler-enabled');
6767
}
6868
```
6969

70-
2. Configure the compiler:
70+
2. Configure o compilador:
7171

7272
```js
7373
{
@@ -78,64 +78,64 @@ export function shouldUseCompiler() {
7878
}
7979
```
8080

81-
3. The compiler generates gated code:
81+
3. O compilador gera código com gating:
8282

8383
```js
84-
// Input
84+
// Entrada
8585
function Button(props) {
8686
return <button>{props.label}</button>;
8787
}
8888

89-
// Output (simplified)
89+
// Saída (simplificada)
9090
import { shouldUseCompiler } from './src/utils/feature-flags';
9191

9292
const Button = shouldUseCompiler()
93-
? function Button_optimized(props) { /* compiled version */ }
94-
: function Button_original(props) { /* original version */ };
93+
? function Button_optimized(props) { /* versão compilada */ }
94+
: function Button_original(props) { /* versão original */ };
9595
```
9696

97-
Note that the gating function is evaluated once at module time, so once the JS bundle has been parsed and evaluated the choice of component stays static for the rest of the browser session.
97+
Note que a função de gating é avaliada uma vez no tempo de módulo, então, assim que o bundle JS for analisado e avaliado, a escolha do componente permanece estática pelo resto da sessão do navegador.
9898

9999
---
100100

101-
## Troubleshooting {/*troubleshooting*/}
101+
## Solução de problemas {/*troubleshooting*/}
102102

103-
### Feature flag not working {/*flag-not-working*/}
103+
### Feature flag não está funcionando {/*flag-not-working*/}
104104

105-
Verify your flag module exports the correct function:
105+
Verifique se o seu módulo de flag exporta a função correta:
106106

107107
```js
108-
//Wrong: Default export
108+
//Errado: Exportação padrão
109109
export default function shouldUseCompiler() {
110110
return true;
111111
}
112112

113-
//Correct: Named export matching importSpecifierName
113+
//Correto: Exportação nomeada correspondendo a importSpecifierName
114114
export function shouldUseCompiler() {
115115
return true;
116116
}
117117
```
118118

119-
### Import errors {/*import-errors*/}
119+
### Erros de importação {/*import-errors*/}
120120

121-
Ensure the source path is correct:
121+
Certifique-se de que o caminho da origem está correto:
122122

123123
```js
124-
//Wrong: Relative to babel.config.js
124+
//Errado: Relativo a babel.config.js
125125
{
126126
source: './src/flags',
127127
importSpecifierName: 'flag'
128128
}
129129

130-
//Correct: Module resolution path
130+
//Correto: Caminho de resolução do módulo
131131
{
132132
source: '@myapp/feature-flags',
133133
importSpecifierName: 'flag'
134134
}
135135

136-
//Also correct: Absolute path from project root
136+
//Também correto: Caminho absoluto a partir da raiz do projeto
137137
{
138138
source: './src/utils/flags',
139139
importSpecifierName: 'flag'
140140
}
141-
```
141+
```

0 commit comments

Comments
 (0)