Skip to content

Commit a2ffb14

Browse files
edgarberlinckgibbok
authored andcommitted
Adding Brazilian Portuguese translation (#137)
1 parent dbd2557 commit a2ffb14

File tree

70 files changed

+9297
-7
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+9297
-7
lines changed

README-pt_BR.md

Lines changed: 3855 additions & 0 deletions
Large diffs are not rendered by default.

README-zh_CN.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,18 @@ class Animal {
421421
constructor(public name: string) {}
422422
}
423423
class Dog extends Animal {
424-
constructor(public name: string, public bark: () => void) {
424+
constructor(
425+
public name: string,
426+
public bark: () => void
427+
) {
425428
super(name);
426429
}
427430
}
428431
class Cat extends Animal {
429-
constructor(public name: string, public meow: () => void) {
432+
constructor(
433+
public name: string,
434+
public meow: () => void
435+
) {
430436
super(name);
431437
}
432438
}
@@ -1996,9 +2002,9 @@ TypeScript 中的相等缩小通过检查变量是否等于特定值来相应缩
19962002
const checkStatus = (status: 'success' | 'error') => {
19972003
switch (status) {
19982004
case 'success':
1999-
return true
2005+
return true;
20002006
case 'error':
2001-
return null
2007+
return null;
20022008
}
20032009
};
20042010
```

tools/i18n.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ export enum Language {
22
en_EN = 'en_EN',
33
zh_CN = 'zh_CN',
44
it_IT = 'it_IT',
5+
pt_BR = 'pt_BR',
56
}
6-
export type Languages = [Language.en_EN, Language.zh_CN, Language.it_IT]
7+
export type Languages = [Language.en_EN, Language.zh_CN, Language.it_IT, Language.pt_BR]
78

8-
export const languages: Languages = [Language.en_EN, Language.zh_CN, Language.it_IT]
9+
export const languages: Languages = [Language.en_EN, Language.zh_CN, Language.it_IT, Language.pt_BR]

tools/make-books.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ DIR_DOWNLOADS="downloads"
77
INPUT_EN="README"
88
INPUT_CN="README-zh_CN"
99
INPUT_IT="README-it_IT"
10+
INPUT_PT="README-pt_BR"
1011

1112
OUTPUT_EN="typescript-book"
1213
OUTPUT_CN="typescript-book-zh_CN"
1314
OUTPUT_IT="typescript-book-it_IT"
15+
OUTPUT_PT="typescript-book-pt_BR"
1416

1517
AUTHOR="Simone Poggiali"
1618
TITLE_EN="The Concise TypeScript Book"
1719
TITLE_CN="# 简洁的TypeScript之书"
1820
TITLE_IT="The Concise TypeScript Book"
21+
TITLE_PT="The Concise TypeScript Book"
1922

2023
cd ../
2124

@@ -45,15 +48,18 @@ fi
4548
pandoc -o $DIR_DOWNLOADS/$OUTPUT_EN.epub --metadata title="$TITLE_EN" --metadata author="$AUTHOR" -s $INPUT_EN.md
4649
pandoc -o $DIR_DOWNLOADS/$OUTPUT_CN.epub --metadata title="$TITLE_CN" --metadata author="$AUTHOR" -s $INPUT_CN.md
4750
pandoc -o $DIR_DOWNLOADS/$OUTPUT_IT.epub --metadata title="$TITLE_IT" --metadata author="$AUTHOR" -s $INPUT_IT.md
51+
pandoc -o $DIR_DOWNLOADS/$OUTPUT_PT.epub --metadata title="$TITLE_PT" --metadata author="$AUTHOR" -s $INPUT_PT.md
4852

4953
# Validate eBooks
50-
epubcheck $DIR_DOWNLOADS/$OUTPUT_CN.epub
54+
epubcheck $DIR_DOWNLOADS/$OUTPUT_EN.epub
5155
epubcheck $DIR_DOWNLOADS/$OUTPUT_CN.epub
5256
epubcheck $DIR_DOWNLOADS/$OUTPUT_IT.epub
57+
epubcheck $DIR_DOWNLOADS/$OUTPUT_PT.epub
5358

5459
# Generate PDFs
5560
ebook-convert $DIR_DOWNLOADS/$OUTPUT_EN.epub $DIR_DOWNLOADS/$OUTPUT_EN.pdf --pdf-page-numbers
5661
ebook-convert $DIR_DOWNLOADS/$OUTPUT_CN.epub $DIR_DOWNLOADS/$OUTPUT_CN.pdf --pdf-page-numbers
5762
ebook-convert $DIR_DOWNLOADS/$OUTPUT_IT.epub $DIR_DOWNLOADS/$OUTPUT_IT.pdf --pdf-page-numbers
63+
ebook-convert $DIR_DOWNLOADS/$OUTPUT_PT.epub $DIR_DOWNLOADS/$OUTPUT_PT.pdf --pdf-page-numbers
5864

5965
echo "Books were created. Please commit!"

website/astro.config.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ export default defineConfig({
4141
label: 'Italiano',
4242
lang: 'it-IT',
4343
},
44+
"pt-br": {
45+
label: "Português (Brasil)",
46+
lang: "pt-BR"
47+
}
4448
},
4549
sidebar: [
4650
{

website/src/content/docs/book/translations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ This book has been translated into several language versions, including:
1212

1313
[Italian](https://github.com/gibbok/typescript-book/blob/main/README-it_IT.md)
1414

15+
[Português (Brasil)](https://github.com/gibbok/typescript-book/blob/main/README-pt_BR.md)

website/src/content/docs/it-it/book/translations.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ Questo libro è stato tradotto in diverse lingue, tra cui:
1212

1313
[Italiano](https://github.com/gibbok/typescript-book/blob/main/README-it_IT.md)
1414

15+
[Português (Brasil)](https://github.com/gibbok/typescript-book/blob/main/README-pt_BR.md)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Sobre o Autor
3+
sidebar:
4+
order: 6
5+
label: 6. Sobre o Autor
6+
---
7+
8+
9+
Simone Poggiali é um experiente Staff Engineer com uma paixão por escrever código de nível profissional desde os anos 90. Ao longo de sua carreira internacional, ele contribuiu para numerosos projetos para uma ampla gama de clientes, desde startups até grandes organizações. Empresas notáveis como HelloFresh, Siemens, O2, Leroy Merlin e Snowplow se beneficiaram de sua expertise e dedicação.
10+
11+
Você pode entrar em contato com Simone Poggiali nas seguintes plataformas:
12+
13+
* LinkedIn: [https://www.linkedin.com/in/simone-poggiali](https://www.linkedin.com/in/simone-poggiali)
14+
* GitHub: [https://github.com/gibbok](https://github.com/gibbok)
15+
* X.com: [https://x.com/gibbok_coding](https://x.com/gibbok_coding)
16+
* Email: gibbok.coding📧gmail.com
17+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Tipo Any
3+
sidebar:
4+
order: 44
5+
label: 44. Tipo Any
6+
---
7+
8+
9+
O tipo `any` é um tipo especial (supertipo universal) que pode ser usado para representar qualquer tipo de valor (primitivos, objetos, arrays, funções, erros, símbolos). Ele é frequentemente usado em situações onde o tipo de um valor não é conhecido em tempo de compilação, ou ao trabalhar com valores de APIs externas ou bibliotecas que não possuem tipagens TypeScript.
10+
11+
Ao utilizar o tipo `any`, você está indicando ao compilador TypeScript que os valores devem ser representados sem quaisquer limitações. Para maximizar a segurança de tipos em seu código, considere o seguinte:
12+
13+
* Limite o uso de `any` a casos específicos onde o tipo é verdadeiramente desconhecido.
14+
* Não retorne tipos `any` de uma função, pois você perderá a segurança de tipos no código que usa essa função, enfraquecendo sua segurança de tipos.
15+
* Em vez de `any`, use `@ts-ignore` se você precisar silenciar o compilador.
16+
17+
```typescript
18+
let value: any;
19+
value = true; // Válido
20+
value = 7; // Válido
21+
```
22+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
title: Atribuições
3+
sidebar:
4+
order: 21
5+
label: 21. Atribuições
6+
---
7+
8+
9+
O narrowing do TypeScript usando atribuições é uma maneira de estreitar o tipo de uma variável com base no valor atribuído a ela. Quando uma variável recebe um valor, o TypeScript infere seu tipo com base no valor atribuído e estreita o tipo da variável para corresponder ao tipo inferido.
10+
11+
```typescript
12+
let value: string | number;
13+
value = 'hello';
14+
if (typeof value === 'string') {
15+
console.log(value.toUpperCase());
16+
}
17+
value = 42;
18+
if (typeof value === 'number') {
19+
console.log(value.toFixed(2));
20+
}
21+
```
22+

0 commit comments

Comments
 (0)