Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class basic syntax #40

Open
wants to merge 4 commits into
base: master
from
Open

Conversation

@Benyaak
Copy link

@Benyaak Benyaak commented Dec 11, 2019

Finished the class basic syntax lesson, I hope everything is okay. Waiting for a review/translation suggestions. Thanks a lot.

@javascript-translate-bot javascript-translate-bot requested a review from javascript-tutorial/translate-ro Dec 11, 2019
@iliakan iliakan mentioned this pull request Dec 11, 2019
9 of 174 tasks complete
@Benyaak
Copy link
Author

@Benyaak Benyaak commented Dec 16, 2019

Solved all suggestion /done

@javascript-translate-bot javascript-translate-bot requested a review from javascript-tutorial/translate-ro Dec 16, 2019

![](class-user.svg)

Here's the code to introspect it:
Iată codul pentru a-l introspecta:

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "a-l introspecta" -> "a-l analiza"


Sometimes people say that `class` is a "syntax sugar" (syntax that is designed to make things easier to read, but doesn't introduce anything new), because we could actually declare the same without `class` keyword at all:
Câteodată oamenii spun că `class` este sugar syntax (sintaxă proiectată într-o manieră în care este mai ușor de citit, dar care nu introduce nimic nou), pentru că am putea să declarăm o clasă și fără sintaxa implicită, în felul următor:

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "....sintaxa implicita...." -> "...sintaxa explicita..."

// 2. Add the method to prototype
// orice funcție prototip are o proprietate constructor în mode implicit

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "functie prototip" -> "prototip de functie"

Typo : "mode implicit" -> "mod implicit"

let user = new User("John");
user.sayHi();
```
Rezultatul definiției este aproape același. Deci, există întreadevăr motive pentru care `class` poate să fie considerat ca și sugar syntax pentru a definii un constructor împreună cu metodele prototipului.

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Typo : "intreadevar" -> "intr-adevar"

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Typo : "pentru a definii" -> "pentru a defini"


1. First, a function created by `class` is labelled by a special internal property `[[FunctionKind]]:"classConstructor"`. So it's not entirely the same as creating it manually.
1. În primul rând, o funcție creadtă de `class` este marcată de o proprietate internă specială `[[FunctionKind]]:"classConstructor"`. Atlfel, nu este în totalitate același lucru cu crearea manuală a acesteia

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Typo : "creadta" -> "creata"

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Typo : "altfel" -> "astfel"

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "cu crearea manuala" -> "ca și crearea manuală"

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Forgot period at the end of the sentence.

```

Also, a string representation of a class constructor in most JavaScript engines starts with the "class..."
De asemenea, o reprezentare a șirului de caractere a unui constructor de clasă în engine-ul JavaScript începe cu "class..."

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Typo : "engine-ul JavaScript" -> "engine-urile Javascript"


That's good, because if we `for..in` over an object, we usually don't want its class methods.
Asta este foarte bine, pentru că daca am folosi `for..in` peste un obiect, nu am vrea toate metodele clasei acestuia.

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "este foarte bine" -> "este bine"

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Typo : "daca" -> "dacă"

All code inside the class construct is automatically in strict mode.
3. Clasele folosesc întotdeauna `use strict`.
Tot codul din interiorul constructorului clasei este în mod automat in stric mode.
Tot codul din cadrul constructorului clasei este automatc in strict mode.

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Remove the 2nd sentence


Besides, `class` syntax brings many other features that we'll explore later.
În plus, sintaxa `class` aduce mult mai multe caracteristici pe care o să le explorăm în curând.

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "In plus" -> "In afara de asta"


Just like functions, classes can be defined inside another expression, passed around, returned, assigned etc.
Exact ca și funcțiile, clasele pot să fie definite în interiorul alte expresii, pot să fie trimise dintr-o parte în alta, returnare, alocate etc.

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "in interiorul alte expresii" -> "in interiorul altor expresii"

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "returnare" -> "returnate"
Grammar suggestion : "alocate" -> "atribuite"


If a class expression has a name, it's visible inside the class only:
Daca o expresie a unei clase are un nume, aceasta este vizibil doar în interiorul clasei:

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Typo : "Daca" -> "Dacă"


If a class expression has a name, it's visible inside the class only:
Daca o expresie a unei clase are un nume, aceasta este vizibil doar în interiorul clasei:

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "este vizibil" -> "este vizibilă"

@lighthousand
Copy link
Member

@lighthousand lighthousand commented Dec 23, 2019

@Benyaak, you're not a romanian native speaker, am i right ? :)

return class {
sayHi() {
alert(phrase);
};
};
}
// Create a new class
let User = makeClass("Hello");
// Crează o nouă clasă

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "Crează" -> "Creează"

```


## Getters/setters, other shorthands

Just like literal objects, classes may include getters/setters, generators, computed properties etc.
Exact ca și literal objects, clasele pot include getteri/setter, generatori, proprietăți computed etc.

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "getteri/setter" -> "getteri/setteri"

```

The class declaration creates getters and setters in `User.prototype`, like this:
Declararea clasei crează getteri și setter în `User.prototype`, exact așa:

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : " crează" -> "creează"

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "setter" -> "setteri"

```

The class declaration creates getters and setters in `User.prototype`, like this:
Declararea clasei crează getteri și setter în `User.prototype`, exact așa:

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "exact așa" -> "astfel"

@@ -282,7 +283,7 @@ Object.defineProperties(User.prototype, {
});
```

Here's an example with a computed property in brackets `[...]`:
Aici este un exemplu cu o proprietate computed folosită între paranteze `[...]`:

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "paranteze" -> "paranteze pătrate"

@@ -298,54 +299,54 @@ class User {
new User().sayHi();
```

For a generator method, similarly, prepend it with `*`.
Pentru o metodă generator, similar, o precedăm cu `*`.

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "o precedăm" -> "o prefixăm"

```warn header="Old browsers may need a polyfill"
Class-level properties are a recent addition to the language.
```warn header="Browserele vechi pot avea nevoie de polyfill"
Proprietațile la nivel de clasă sunt o adiție recentă.

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Typo : "Proprietațile" -> "Proprietățile"

```

In the example above, `User` only had methods. Let's add a property:
În exemplul de mai sus, `User` avea doar metode. Hai să adăugam o proprietate:

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "În exemplul de mai sus" -> "Exemplul de mai sus"

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Typo : "adăugam" -> "adăugăm"

}
}
new User().sayHi();
```

The property `name` is not placed into `User.prototype`. Instead, it is created by `new` before calling constructor, it's the property of the object itself.
Proprietatea `name` nu este introdusă în `User.prototype`. În schimb, aceasta este creată de `new` înainte de apelarea constructorului, it's the property of the object itself.

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "creată de" -> "creeată de"

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

There's a part that has not been translated : "it's the property of the object itself."


## Summary
## Sumar

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "Rezumat"


The basic class syntax looks like this:
Sintaxa de bază a unei clase arată în felul următor:

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "a unei clase" -> "a clasei"


In the next chapters we'll learn more about classes, including inheritance and other features.
În următoarele capitole o să învățăm mai multe despre clase, printre care o să învătăm despre moșternie și alte caracteristici ale acestora.

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "alte caracteristici ale acestora" -> "alte caracteristici"

This comment has been minimized.

@lighthousand

lighthousand Dec 23, 2019
Member

Grammar suggestion : "printre care o să învătăm despre " -> "printre care moștenire și alte caracteristici"

Copy link
Member

@lighthousand lighthousand left a comment

Overall, good job !

@javascript-translate-bot
Copy link

@javascript-translate-bot javascript-translate-bot commented Dec 23, 2019

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@CLAassistant
Copy link

@CLAassistant CLAassistant commented Mar 8, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.