Skip to content

The modern mode, "use strict" - #15

Merged
szcsl merged 17 commits into
javascript-tutorial:masterfrom
szvvx:JustIzumi-strict-mode
Jan 3, 2021
Merged

szcsl merged 17 commits into
javascript-tutorial:masterfrom
szvvx:JustIzumi-strict-mode

Conversation

@szvvx

@szvvx szvvx commented Dec 20, 2020

Copy link
Copy Markdown
Contributor

No description provided.

@szcsl szcsl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @justizumi!

Thanks for the PR! I appreciate your contribution, but unfortunately, the hungarian translation is awkward on occassions and this can hinder understanding for newbies.

I am happy to help make it sound more natural, although it will require a bit of a rewrite -- but the PR and the contribution would still be yours. :)

May I comment your PRs?

@szvvx

szvvx commented Dec 25, 2020

Copy link
Copy Markdown
Contributor Author

Dear @szcsl

Thank you for reviewing my pull request! I also noticed, that my translation may not be as good as it should be, but I would be more than happy, if you could help me improve it! So please feel free to comment my PR's!

Tips on how to be better at translating in the first place are appreciated too :)

@szcsl szcsl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for commenting a lot. I tried to honor the initial translation as much as possible, but I have a strong preference for reducing unnecessary constructs. But again, many thanks for taking your time!

I put the whole replacement text in the comment for each line, where applicable. Feel free to ask if in doubt. I'll setup a more convenient communaction channel soon, to ease the conversation.

I could have merged it and update it myself, but I don't want to hijack your contribution. If you prefer, I can simply merge and update the other PR and any future PRs -- but I think it's fair, to have it merged as your PR. :)

My general guidelines for translations are:

  • Think about the point of the original text and try to convey the same message in your own words as clearly and succintly as possible. You don't have to stick with the structure and phrasing of the original text if that would be more verbose or just awkward.
  • A nice summary of general guidelines: https://www.accelingo.com/technical-translation-best-practices/

@@ -1,89 +1,89 @@
# The modern mode, "use strict"
# A modern mode, "use strict"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modern ΓΌzemmΓ³d, "use strict"

# A modern mode, "use strict"

For a long time, JavaScript evolved without compatibility issues. New features were added to the language while old functionality didn't change.
Egy hosszΓΊ ideig a JavaScript kompatibilitΓ‘si hibΓ‘k nΓ©lkΓΌl fejlΕ‘dΓΆtt. Új funkciΓ³k gyakran jelentek meg, Γ‘m a rΓ©giek viszont sosem vΓ‘ltoztak.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A JavaScript hosszΓΊ ideig kompatibilitΓ‘si nehΓ©zsΓ©gek nΓ©lkΓΌl fejlΕ‘dΓΆtt. A nyelv ΓΊj elemekkel bΕ‘vΓΌlt, a meglΓ©vΕ‘ek pedig vΓ‘ltozatlanok voltak.

Egy hosszΓΊ ideig a JavaScript kompatibilitΓ‘si hibΓ‘k nΓ©lkΓΌl fejlΕ‘dΓΆtt. Új funkciΓ³k gyakran jelentek meg, Γ‘m a rΓ©giek viszont sosem vΓ‘ltoztak.

That had the benefit of never breaking existing code. But the downside was that any mistake or an imperfect decision made by JavaScript's creators got stuck in the language forever.
Ennek nagy elΕ‘nye volt, hogy a kΓ³dot bΓ‘rmikor is Γ­rtΓ‘k mindig helytΓ‘llΓ³ maradt, Γ‘m viszont azzal hogy a rΓ©gi dolgok sosem vΓ‘ltoztak azzal az a nagy baj, hogy bΓ‘rmilyen imperfekciΓ³t is ejtettek a JavaScript kΓ©szΓ­tΕ‘i, az ΓΆrΓΆkre a nyelvben ragadt.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nyelv ΓΊjabb verziΓ³i Γ­gy kompatibilisek maradtak a korΓ‘bban Γ­rt programokkal, cserΓ©be viszont egyΓΌtt kellett Γ©lni a nyelv tervezΓ©sekor hozott rossz dΓΆntΓ©sekkel.


This was the case until 2009 when ECMAScript 5 (ES5) appeared. It added new features to the language and modified some of the existing ones. To keep the old code working, most such modifications are off by default. You need to explicitly enable them with a special directive: `"use strict"`.
Ez volt a helyzet, mΓ­g 2009-ben meg nem jelent az ECMAScript 5 (ES5). Az ES5 sok ΓΊj funkciΓ³t hozott a JS-be Γ©s sok rΓ©git is megvΓ‘ltoztatott. Ahoz hogy a rΓ©gi kΓ³d tovΓ‘bbΓ‘ is mΕ±kΓΆdΕ‘kΓ©pes maradhasson, ezeknek a vΓ‘ltoztatΓ‘soknak nagy rΓ©szΓ©t alapbΓ³l kikapcsoltΓ‘k. Ezeket a funciΓ³kat egy kΓΌlΓΆnleges diretΓ­vΓ‘val kapcsolhatjuk be, a `"use strict"`-el.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ez volt a tΓ©nyΓ‘llΓ‘s, mΓ­gnem 2009-ben megjelent az ECMAScript 5 (ES5), amely nem csak bΕ‘vΓ­tette a nyelvet, hanem nΓ©hol meg is vΓ‘ltoztatta a mΕ±kΓΆdΓ©sΓ©t. Annak Γ©rdekΓ©ben, hogy ezek a vΓ‘ltozΓ‘sok ne okozzanak gondot a rΓ©gebben Γ­rt programokban, e vΓ‘ltoztatΓ‘sok alapΓ©rtelmezetten ki vannak kapcsolva, az engedΓ©lyezΓ©sΓΌkhΓΆz pedig egy speciΓ‘lis "use strict" diektΓ­vΓ‘t kell elhelyezni a kΓ³dban.

## "use strict"

The directive looks like a string: `"use strict"` or `'use strict'`. When it is located at the top of a script, the whole script works the "modern" way.
Ez a direktΓ­va pontosan ΓΊgy nΓ©z ki mint egy Γ‘tlagos szΓΆveg (string) objektum: `"use strict"`, vagy `'use strict'`. Mikor ezt a direktΓ­vΓ‘t a szkript tetejΓ©re hejezed, akkor az a szkriptet arra utasΓ­tja, hogy a "modern mΓ³don" mΕ±kΓΆdjΓΆn.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ez a direktΓ­va rΓ‘nΓ©zΓ©sre egy Γ‘tlagos szΓΆveg (string): "use strict", vagy 'use strict'. A szkript tetejΓ©re helyezve azonban arra utasΓ­tja a JS motort, hogy a szkriptet modern ΓΌzemmΓ³dban futtassa.

Ez a kΓ©rdΓ©s, mΓ­g elΕ‘szΓΆr elΓ©ggΓ© egyΓ©rtelmΕ±nek hangzik, a valΓ³sΓ‘gban nem az.

One could recommend to start scripts with `"use strict"`... But you know what's cool?
Ugye, egyesek azt ajΓ‘nlanΓ‘k, hogy hasznΓ‘ld elΕ‘szeretettel a `"use strict"`-et ...De tudod mi itt a menΕ‘ dolog?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okkal gondolhatnΓ‘nk, hogy mindig Γ©rdemes hasznΓ‘lni a "use strict"-et, de erre nincs szΓΌksΓ©g.

Ugye, egyesek azt ajΓ‘nlanΓ‘k, hogy hasznΓ‘ld elΕ‘szeretettel a `"use strict"`-et ...De tudod mi itt a menΕ‘ dolog?

Modern JavaScript supports "classes" and "modules" - advanced language structures (we'll surely get to them), that enable `use strict` automatically. So we don't need to add the `"use strict"` directive, if we use them.
A modern JavaScript tΓ‘mogat olyanokat mint pΓ©ldΓ‘ul a "class"-ek Γ©s a "module"-ok (majd azokat is tanulni fogjuk), amik automatikusan engedΓ©lyezik a `"use strict"`-et. TehΓ‘t ha ilyenek vannak a kΓ³dunkban, a `"use strict"`-et nyugodtan nΓ©lkΓΌlΓΆzhetjΓΌk.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A modern JavaScript egyes nyelvi elemei, mint az osztΓ‘ly (class) Γ©s a modul (module) - ezeket kΓ©sΕ‘bb rΓ©szletezzΓΌk - alapΓ©rtelmezetten strict ΓΌzemmΓ³dban futnak, Γ­gy ezeknek a nyelvi elemeknek a hasznΓ‘latakor a "use strict" elhagyhatΓ³.

A modern JavaScript tΓ‘mogat olyanokat mint pΓ©ldΓ‘ul a "class"-ek Γ©s a "module"-ok (majd azokat is tanulni fogjuk), amik automatikusan engedΓ©lyezik a `"use strict"`-et. TehΓ‘t ha ilyenek vannak a kΓ³dunkban, a `"use strict"`-et nyugodtan nΓ©lkΓΌlΓΆzhetjΓΌk.

**So, for now `"use strict";` is a welcome guest at the top of your scripts. Later, when your code is all in classes and modules, you may omit it.**
**TehΓ‘t egyelΕ‘re a `"use strict";` az csak egy kis extra a szkriptjeink elejΓ©n. KΓ©sΕ‘bb, amikor a kΓ³dunk tele lesz modulokkal Γ©s classokkal, mΓ‘r nyugodtan kihagyhatjuk a `"use strict"`-et.**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EgyelΕ‘re jΓ³, ha hasznΓ‘ljuk a "use strict"-et, de kΓ©sΕ‘bb, amikor a kΓ³dunk modulokbΓ³l Γ©s osztΓ‘lyokbΓ³l Γ‘ll, elhagyhatjuk.

A kΓΆvetkezΕ‘ fejezetekben tanulunk majd egy kicsit a nyelvi funckiΓ³krΓ³l Γ©s az ΓΊj Γ©s rΓ©gi mΓ³dok kΓΆzti kΓΌlΓΆnbsΓ©gekrΕ‘l. SzerencsΓ©nkre az utΓ³bbiakbΓ³l nincsen sok, Γ©s azok amik vannak azok is csak a mi dolgunkat fogjΓ‘k kΓΆnnyΓ­teni.

All examples in this tutorial assume strict mode unless (very rarely) specified otherwise.
Az ebben a fejezetben lΓ©vΕ‘ pΓ©ldΓ‘k mind elvΓ‘rjΓ‘k a "strict mode" hasznΓ‘latΓ‘t, hacsak ennek az Γ‘llΓ­tΓ‘snak hamissΓ‘gΓ‘t nem fejeztΓΌk ki elΕ‘re.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Az ebben a fejezetben lΓ©vΕ‘ pΓ©ldΓ‘k, ha nincs mΓ‘skΓ©nt feltΓΌntetve, strict ΓΌzemmΓ³dot feltΓ©teleznek.

Ez a legtΓΆbb bΓΆngΓ©szΕ‘ben (mint pΓ©ldΓ‘ul a Chrome vagy a Firefox) mΕ±kΓΆdik.

If it doesn't, e.g. in an old browser, there's an ugly, but reliable way to ensure `use strict`. Put it inside this kind of wrapper:
Ha esetleg mΓ©gse (pΓ©ldΓ‘ul egy rΓ©gi bΓΆngΓ©szΕ‘ben), akkor van egy csΓΊnya, de megbΓ­zhatΓ³ megoldΓ‘s a `use strict` hasznΓ‘latΓ‘ra. Egy ilyesmi kΓ³d blokkra lesz szΓΌksΓ©gΓΌnk:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha ez nem mΕ±kΓΆdne (pΓ©ldΓ‘ul rΓ©gi bΓΆngΓ©szΕ‘ben), akkor egy megbΓ­zhatΓ³ megoldΓ‘s az alΓ‘bbi konstrukciΓ³ hasznΓ‘lata:

@javascript-translate-bot

Copy link
Copy Markdown

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

@szvvx

szvvx commented Jan 1, 2021

Copy link
Copy Markdown
Contributor Author

/done

@szcsl szcsl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for following through! :) I will review the other PR soon.

@szcsl
szcsl merged commit f3b44db into javascript-tutorial:master Jan 3, 2021
@javascript-translate-bot

Copy link
Copy Markdown

Thank you πŸ’– I updated the Progress Issue #1 πŸŽ‰ πŸŽ‰ πŸŽ‰

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants