Skip to content

Commit b0d962b

Browse files
committed
First translate to pt_BR stage, stopped in line 270. Need some reviews from other people.
1 parent abbc78b commit b0d962b

File tree

1 file changed

+83
-81
lines changed

1 file changed

+83
-81
lines changed

readme.md

Lines changed: 83 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Principles of Writing Consistent, Idiomatic JavaScript
1+
# Princípios para Escrever Javascript de forma Consistente e Idiomática
22

3-
## This is a living document and new ideas for improving the code around us are always welcome. Contribute: fork, clone, branch, commit, push, pull request.
3+
## Este é um documento vivo e novas idéias para melhorar os códigos correspondentes são sempre bem vindas. Contribua: faça fork, clone, branch, commit, push, pull request.
44

55
* Rick Waldron [@rwaldron](http://twitter.com/rwaldron), [github](https://github.com/rwldrn)
66
* Mathias Bynens [@mathias](http://twitter.com/mathias), [github](https://github.com/mathiasbynens)
@@ -9,24 +9,26 @@
99
* Raynos [github](https://github.com/Raynos)
1010
* Matias Arriola [@MatiasArriola](https://twitter.com/MatiasArriola), [github](https://github.com/MatiasArriola/)
1111
* Idan Gazit [@idangazit](http://twitter.com/idangazit), [github](https://github.com/idangazit)
12+
* Leo Balter [@leobalter](http://twitter.com/leobalter), [github](https://github.com/leobalter)
1213

13-
## All code in any code-base should look like a single person typed it, no matter how many people contributed.
14+
## Todo código em qualquer aplicação deve parecer como se fosse escrito por uma única pessoa, independente de quantas pessoas tenham contribuído.
1415

15-
### The following list outlines the practices that I use in all code that I am the original author of; contributions to projects that I have created should follow these guidelines.
16+
### A lista a seguir descreve as práticas que eu uso em todo código onde sou o autor original; contribuições em projetos que eu criei devem seguir essas mesmas orientações.
1617

17-
### I do not intend to impose my style preferences on other people's code; if they have an existing common style - this should be respected.
18+
### Eu não tenho a intenção de impor minhas preferências por estilos nos códigos de outras pessoas; se eles seguem um estilo em comum - isso deve ser respeitado.
1819

19-
> "Part of being a good steward to a successful project is realizing that writing code for yourself is a Bad Idea™. If thousands of people are using your code, then write your code for maximum clarity, not your personal preference of how to get clever within the spec." - Idan Gazit
20+
> "Parte de ser um bom gestor de um projeto bem sucedido é perceber que escrever código para si mesmo é uma má idéia™. Se milhares de pessoas estão utilizando o seu código, então escreva o seu código com máxima clareza, não sob a sua preferência pessoal sobre como ser esperto com uma especificação." - Idan Gazit
2021
21-
## Translations
22+
## Traduções
2223

2324
* [French](https://github.com/jfroffice/idiomatic.js/)
2425
* [Spanish](https://github.com/MatiasArriola/idiomatic.js/)
26+
* [Português - Brasil](https://github.com/leobalter/idiomatic.js/)
2527

2628

27-
## Important, Non-Idiomatic Stuff:
29+
## Conteúdo Importante e Não Idiomático:
2830

29-
### Code Quality: Awesome Tools, Resources & References
31+
### Qualidade de Código: Ferramentas, Recursos e Referências Bacanas
3032

3133
* [jsPerf](http://jsperf.com/)
3234
* [jsFiddle](http://jsfiddle.net/)
@@ -35,14 +37,14 @@
3537
* [jshint](http://jshint.com/)
3638
* [jslint](http://jslint.org/)
3739

38-
[Leveraging Code Quality Tools by Anton Kovalyov](http://anton.kovalyov.net/slides/gothamjs/)
40+
[Leveraging Code Quality Tools (em pt_BR: Aproveitamento de Ferramentas de Qualidade de Código) por Anton Kovalyov](http://anton.kovalyov.net/slides/gothamjs/)
3941

4042

41-
### Get Smart
43+
### Fique Ligado
4244

4345
[http://es5.github.com/](http://es5.github.com/)
4446

45-
The following should be considered 1) incomplete, and 2) *REQUIRED READING*. I don't always agree with the style written by the authors below, but one thing is certain: They are consistent. Furthermore, these are authorities on the language.
47+
Deve ser considerado o seguinte: 1) incompleto; e 2) *LEITURA OBRIGATÓRIA*. Eu não concordo sempre com os estilos escritos pelos autores abaixo, mas uma coisa é certa: Eles são consistentes. Além disso, esses são autoridades na linguagem.
4648

4749
* [Eloquent JavaScript](http://eloquentjavascript.net/)
4850
* [JavaScript, JavaScript](http://javascriptweblog.wordpress.com/)
@@ -51,16 +53,16 @@ The following should be considered 1) incomplete, and 2) *REQUIRED READING*. I d
5153
* [Douglas Crockford's Wrrrld Wide Web](http://www.crockford.com)
5254

5355

54-
### Build & Deployment Process
56+
### Processos de Build e Deploy
5557

56-
Projects should always attempt to include some generic means by which source can be compressed in preparation for production use. Some popular and proven tools include the JavaScript-based [Uglify.js](https://github.com/mishoo/UglifyJS), as well as the Java-based [Google Closure Compiler](http://code.google.com/closure/compiler/) and [YUI Compressor](http://developer.yahoo.com/yui/compressor/). Choose one and support it.
58+
Projetos devem sempre tentar incluir alguns formatos genéricos para que o código fonte possa ser compactado no preparo para uso em produção. Algumas ferramentas populares e testadas incluem o [Uglify.js](https://github.com/mishoo/UglifyJS) feito em JavaScript, assim como o [Google Closure Compiler](http://code.google.com/closure/compiler/) e [YUI Compressor](http://developer.yahoo.com/yui/compressor/) feitos em Java. Escolha um e apoie o mesmo.
5759

58-
You can now find a functional, generic "build kit" in the `/kits` directory of this repository. Usage is easy: 1) copy the contents of a kit found in `/kits` to a new working directory, 2) save your project .js file in the `/src` directory, 3) put the name of the project in `project.txt`, 4) run `make` from command line. (Even easier directions: replace occurrences of "foo")
60+
Você pode encontrar um "build kit" funcional e genérico no diretório `/kits` deste repositório. A Utilização é simples: 1) copie o conteúdo de um dos kits encontrados em `/kits` para um novo diretório, 2) grave o arquivo .js de seu projeto no diretório `/src`, 3) coloque o nome do projeto dentro de `project.txt`, 4) execute o `make` pela linha de comando. (Caminho mais fácil: troque as ocorrências de "foo")
5961

6062

61-
### Test Facility
63+
### Ambiente de Teste
6264

63-
Projects _must_ include some form of unit, reference, implementation or functional testing. Use case demos DO NOT QUALIFY as "tests". The following is a list of test frameworks, none of which are endorsed more than the other.
65+
Projetos _devem_ incluir alguma forma de teste unitário, por referência, de implementaçao ou funcional. Demonstrações de casos de uso NÃO SE QUALIFICAM como "testes". A lista a seguir contém frameworks de testes, nenhuma delas é considerada melhor que as demais.
6466

6567
* [QUnit](http://github.com/jquery/qunit)
6668
* [Jasmine](https://github.com/pivotal/jasmine)
@@ -69,132 +71,132 @@ Projects _must_ include some form of unit, reference, implementation or function
6971
* [Hiro](http://hirojs.com/)
7072
* [JsTestDriver](https://code.google.com/p/js-test-driver/)
7173

72-
## Table of Contents
74+
## Tabela de Conteúdos
7375

74-
* [Whitespace](#whitespace)
75-
* [Beautiful Syntax](#spacing)
76-
* [Type Checking (Courtesy jQuery Core Style Guidelines)](#type)
77-
* [Conditional Evaluation](#cond)
78-
* [Practical Style](#practical)
79-
* [Naming](#naming)
80-
* [Misc](#misc)
81-
* [Native & Host Objects](#native)
82-
* [Comments](#comments)
76+
* [Espaço em Branco](#whitespace)
77+
* [Sintaxe Bonita](#spacing)
78+
* [Checagem de Escrita (Cortesia das Recomendações de Estilo do Núcleo do jQuery)](#type)
79+
* [Avaliação Condicional](#cond)
80+
* [Estilo Prático](#practical)
81+
* [Nomenclatura](#naming)
82+
* [Miscelâneas](#misc)
83+
* [Objetos Nativos e Hospedados](#native)
84+
* [Comentários](#comments)
8385

8486

85-
## Idiomatic Style Manifesto
87+
## Manifesto de Estilo Idiomático
8688

8789

88-
1. <a name="whitespace">Whitespace</a>
90+
1. <a name="whitespace">Espaço em Branco</a>
8991

90-
* Never mix spaces and tabs.
91-
* When beginning a project, before you write any code, choose between soft indents (spaces) or real tabs &mdash; this is law.
92-
* For readability, I always recommend setting your editor's indent size to two characters &mdash; this means two spaces or two spaces representing a real tab.
93-
* If your editor supports it, always work with the "show invisibles" setting turned on. The benefits of this practice are:
94-
* Enforced consistency
95-
* Eliminating end of line whitespace
96-
* Eliminating blank line whitespace
97-
* Commits and diffs that are easier to read
92+
* Nunca misture espaços e tabs.
93+
* Quando começar um projeto, antes de escrever qualquer código, escolha entre indentação suave (espaços) ou tabulação real (tabs) - isso é lei.
94+
* Pela legibilidade, eu sempre recomendo que configure o tamanho de indentação de seu editor para dois caracteres - isso significa dois espaços ou dois espaços representando um tab real.
95+
* Se o seu editor suportar, sempre trabalhe com a configuração de "mostrar caracteres invisíveis" ligada. Os benefícios desta prática são:
96+
* Fortalecer a consistência
97+
* Eliminação de espaço em branco ao final da linha
98+
* Eliminação de espaços em uma linha em branco
99+
* Leituras de commits e diffs ficam mais legíveis
98100

99101

100-
2. <a name="spacing">Beautiful Syntax</a>
102+
2. <a name="spacing">Sintaxe Bonita</a>
101103

102-
A. Parens, Braces, Linebreaks
104+
A. Parênteses, Chaves e Quebras de Linhas
103105

104106
```javascript
105107

106-
// if/else/for/while/try always have spaces, braces and span multiple lines
107-
// this encourages readability
108+
// if/else/for/while/try sempre tem espaços, chaves e ocorrem em múltiplas linhas
109+
// isso facilita a legibilidade
108110

109111
// 2.A.1.1
110-
// Examples of really cramped syntax
112+
// Exemplos de código pouco claro/bagunçado
111113

112-
if(condition) doSomething();
114+
if(condicao) facaAlgo();
113115

114-
while(condition) iterating++;
116+
while(condicao) iteracao++;
115117

116-
for(var i=0;i<100;i++) someIterativeFn();
118+
for(var i=0;i<100;i++) algumaIteracao();
117119

118120

119121
// 2.A.1.1
120-
// Use whitespace to promote readability
122+
// Use espaço em branco para facilitar a leitura
121123

122-
if ( condition ) {
123-
// statements
124+
if ( condicao ) {
125+
// instruções
124126
}
125127

126-
while ( condition ) {
127-
// statements
128+
while ( condicao ) {
129+
// instruções
128130
}
129131

130132
for ( var i = 0; i < 100; i++ ) {
131-
// statements
133+
// instruções
132134
}
133135

134-
// Even better:
136+
// Ainda melhor:
135137

136138
var i,
137139
length = 100;
138140

139141
for ( i = 0; i < length; i++ ) {
140-
// statements
142+
// instruções
141143
}
142144

143-
// Or...
145+
// Ou...
144146

145147
var i = 0,
146148
length = 100;
147149

148150
for ( ; i < length; i++ ) {
149-
// statements
151+
// instruções
150152
}
151153

152154
var prop;
153155

154156
for ( prop in object ) {
155-
// statements
157+
// instruções
156158
}
157159

158160

159161
if ( true ) {
160-
// statements
162+
// instruções
161163
} else {
162-
// statements
164+
// instruções
163165
}
164166
```
165167

166168

167-
B. Assignments, Declarations, Functions ( Named, Expression, Constructor )
169+
B. Atribuições, Declarações, Funções ( Nomenclatura, Expressão, Construtor )
168170

169171
```javascript
170172

171173
// 2.B.1.1
172-
// Variables
174+
// Variáveis
173175
var foo = "bar",
174176
num = 1,
175177
undef;
176178

177-
// Literal notations:
179+
// Notações Literais:
178180
var array = [],
179181
object = {};
180182

181183

182184
// 2.B.1.2
183-
// Using only one `var` per scope (function) promotes readability
184-
// and keeps your declaration list free of clutter (also saves a few keystrokes)
185-
186-
// Bad
185+
// Utilizando apenas um `var` por escopo (função) promove legibilidade
186+
// e mantém a sua lista de declaração livre de desordem (além de evitar algumas tecladas)
187+
188+
// Ruim
187189
var foo = "";
188190
var bar = "";
189191
var qux;
190192

191-
// Good
193+
// Bom
192194
var foo = "",
193195
bar = "",
194196
quux;
195197

196-
// or..
197-
var // Comment on these
198+
// ou..
199+
var // comentário aqui
198200
foo = "",
199201
bar = "",
200202
quux;
@@ -204,44 +206,44 @@ Projects _must_ include some form of unit, reference, implementation or function
204206
```javascript
205207

206208
// 2.B.2.1
207-
// Named Function Declaration
209+
// Declaração de Função Nomeada
208210
function foo( arg1, argN ) {
209211

210212
}
211213

212-
// Usage
214+
// Utilização
213215
foo( arg1, argN );
214216

215217

216218
// 2.B.2.2
217-
// Named Function Declaration
219+
// Declaração de Função Nomeada
218220
function square( number ) {
219221
return number * number;
220222
}
221223

222-
// Usage
224+
// Utilização
223225
square( 10 );
224226

225-
// Really contrived continuation passing style
227+
// Estilo de passagem artificialmente contínua
226228
function square( number, callback ) {
227229
callback( number * number );
228230
}
229231

230232
square( 10, function( square ) {
231-
// callback statements
233+
// instruções de callback
232234
});
233235

234236

235237
// 2.B.2.3
236-
// Function Expression
238+
// Expressão de Função
237239
var square = function( number ) {
238-
// Return something valuable and relevant
240+
// Retorna algo de valor e relevante
239241
return number * number;
240242
};
241243

242-
// Function Expression with Identifier
243-
// This preferred form has the added value of being
244-
// able to call itself and have an identity in stack traces:
244+
// Expressão de Função com Identificador
245+
// Esse formato preferencial tem o valor adicional de permitir
246+
// chamar a si mesmo e ter uma identidade na pilha de comandos:
245247
var factorial = function factorial( number ) {
246248
if ( number < 2 ) {
247249
return 1;
@@ -252,13 +254,13 @@ Projects _must_ include some form of unit, reference, implementation or function
252254

253255

254256
// 2.B.2.4
255-
// Constructor Declaration
257+
// Declaração de Construtor
256258
function FooBar( options ) {
257259

258260
this.options = options;
259261
}
260262

261-
// Usage
263+
// Utilização
262264
var fooBar = new FooBar({ a: "alpha" });
263265

264266
fooBar.options;

0 commit comments

Comments
 (0)