Skip to content

Unicode: flag "u" and class \p{...} #374

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

Merged
merged 2 commits into from
Oct 12, 2022

Conversation

lanachayka
Copy link
Contributor

No description provided.

@CLAassistant
Copy link

CLAassistant commented Jul 24, 2022

CLA assistant check
All committers have signed the CLA.

@dolgachio dolgachio self-assigned this Aug 4, 2022
@dolgachio dolgachio changed the title translate an article: Unicode: flag u and class \p{...} Unicode: flag "u" and class \p{...} Aug 4, 2022
@dolgachio
Copy link
Collaborator

#1

@dolgachio dolgachio added the in progress Translation in progress label Aug 4, 2022
Copy link
Collaborator

@dolgachio dolgachio left a comment

Choose a reason for hiding this comment

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

Дякую, за чудовий переклад! Вибачаюсь, що так довго перевіряв.
Наступного разу все буде набагато швидше =)

Внесіть, будь ласка, зміни про які я написав. Якщо будуть питання, напишіть мені :)

|------------|---------|--------|
| a | `0x0061` | 2 |
| ≈ | `0x2248` | 2 |
|𝒳| `0x1d4b3` | 4 |
|𝒴| `0x1d4b4` | 4 |
|😄| `0x1f604` | 4 |

So characters like `a` and `≈` occupy 2 bytes, while codes for `𝒳`, `𝒴` and `😄` are longer, they have 4 bytes.
Таким чином, такі символи, як `a` і `≈`, займають 2 байти, а коди для `𝒳`, `𝒴` і `😄` довші, в них - 4 байти.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Таким чином, такі символи, як `a` і ``, займають 2 байти, а коди для `𝒳`, `𝒴` і `😄` довші, в них - 4 байти.
Таким чином, такі символи, як `a` і ``, займають 2 байти, а коди для `𝒳`, `𝒴` і `😄` довші, в них -- 4 байти.


Long time ago, when JavaScript language was created, Unicode encoding was simpler: there were no 4-byte characters. So, some language features still handle them incorrectly.
Коли створювалась мова JavaScript, кодування Юнікод було простіше: 4-байтвоих символів не існувало. Тому досі деякі функції мови все ще обробляють їх неправильно.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Коли створювалась мова JavaScript, кодування Юнікод було простіше: 4-байтвоих символів не існувало. Тому досі деякі функції мови все ще обробляють їх неправильно.
Коли створювалась мова JavaScript, кодування Юнікод було простіше: 4-байтових символів не існувало. Тому досі деякі функції мови все ще обробляють їх неправильно.


```js run
alert('😄'.length); // 2
alert('𝒳'.length); // 2
```
...Але ми бачимо, що лише один, правда ж? Річ у тому, що властивість `length` трактує 4 байти, як два символи по 2 байти. Це не правильно, адже їх необхідно розглядати тільки разом (так звана "сурогатна пара", детальніше у розділі <info:string>).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Перенесіть, будь ласка, цей текст на наступний рядок. У перекладі має бути стільки ж рядків, як і в оригінальній статті. Це необхідно щоб у майбутньому синхронізувати зміни.


...But we can see that there's only one, right? The point is that `length` treats 4 bytes as two 2-byte characters. That's incorrect, because they must be considered only together (so-called "surrogate pair", you can read about them in the article <info:string>).
За замовчуванням регулярні вирази також розглядають 4-байтові «довгі символи» як пару 2-байтових. Як і у випадку з рядками, це може призвести до дивних результатів. Ми побачимо це трохи пізніше, у розділі <info:regexp-character-sets-and-ranges>.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
За замовчуванням регулярні вирази також розглядають 4-байтові «довгі символи» як пару 2-байтових. Як і у випадку з рядками, це може призвести до дивних результатів. Ми побачимо це трохи пізніше, у розділі <info:regexp-character-sets-and-ranges>.
За замовчуванням регулярні вирази також розглядають 4-байтові "довгі символи" як пару 2-байтових. Як і у випадку з рядками, це може призвести до дивних результатів. Ми побачимо це трохи пізніше, у розділі <info:regexp-character-sets-and-ranges>.


## Unicode properties \p{...}
Кожен символ в кодуванні Юнікод має багато властивостей. Вони описують, до якої «категорії» належить символ та містять різну інформацію про нього.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Кожен символ в кодуванні Юнікод має багато властивостей. Вони описують, до якої «категорії» належить символ та містять різну інформацію про нього.
Кожен символ в кодуванні Юнікод має багато властивостей. Вони описують, до якої "категорії" належить символ та містять різну інформацію про нього.

- `Hex_Digit` містить шістнадцяткові числа: `0-9`, `a-f`.
- ...І так далі.

Юнікод підтримує велику кількість властивостей, і їхній повний перелік потребував би дуже багато місця, тому ось посилання.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Юнікод підтримує велику кількість властивостей, і їхній повний перелік потребував би дуже багато місця, тому ось посилання.
Юнікод підтримує велику кількість властивостей, і їхній повний перелік вимагав би дуже багато місця, тому ось посилання:


There's a Unicode property `Script` (a writing system), that may have a value: `Cyrillic`, `Greek`, `Arabic`, `Han` (Chinese) and so on, [here's the full list](https://en.wikipedia.org/wiki/Script_(Unicode)).
Нам допоможе властивість Юнікоду - `Script` (система письма), яка може мати значення: `Cyrillic`(Кирилиця), `Greek` (Грецька), `Arabic` (Арабська), `Han` (Китайська) та інші, [тут повний перелік](https://en.wikipedia.org/wiki/Script_(Unicode)).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Нам допоможе властивість Юнікоду - `Script` (система письма), яка може мати значення: `Cyrillic`(Кирилиця), `Greek` (Грецька), `Arabic` (Арабська), `Han` (Китайська) та інші, [тут повний перелік](https://en.wikipedia.org/wiki/Script_(Unicode)).
Нам допоможе властивість Юнікоду -- `Script` (система письма), яка може мати значення: `Cyrillic`(Кирилиця), `Greek` (Грецька), `Arabic` (Арабська), `Han` (Китайська) та інші, [тут повний перелік](https://en.wikipedia.org/wiki/Script_(Unicode)).

  - не призначенні `Cn`,
- для приватного користування `Co`,
- сурогат `Cs`.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Додайте тут, будь ласка, пустий рядок як було в оригінальній статті. Це потрібно знову ж таки для сумісності з англійським варіантом.

@javascript-translate-bot
Copy link
Contributor

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

@lanachayka
Copy link
Contributor Author

/done

@dolgachio
Copy link
Collaborator

@all-contributors please add @lanachayka for translate

@allcontributors
Copy link
Contributor

@stas-dolgachov

I couldn't determine any contributions to add, did you specify any contributions?
Please make sure to use valid contribution names.

@dolgachio
Copy link
Collaborator

https://github.com/all-contributors please add @lanachayka for translate

@dolgachio
Copy link
Collaborator

https://github.com/all-contributors please add @lanachayka for translation

@dolgachio
Copy link
Collaborator

@all-contributors please add @lanachayka for translation

@allcontributors
Copy link
Contributor

@stas-dolgachov

I've put up a pull request to add @lanachayka! 🎉

@javascript-translate-bot
Copy link
Contributor

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
in progress Translation in progress needs +1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants