Skip to content

Translation List and keys - #64

Merged
gaearon merged 4 commits into
reactjs:masterfrom
Windrushfarer:list-and-keys
Feb 12, 2019
Merged

Translation List and keys#64
gaearon merged 4 commits into
reactjs:masterfrom
Windrushfarer:list-and-keys

Conversation

@Windrushfarer

Copy link
Copy Markdown
Contributor

No description provided.

@WindrushfarerWindrushfarer mentioned this pull request Feb 10, 2019
88 tasks
Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
Когда вы запустите данный код, то увидите предупреждение о том, что у каждого элемента массива должен быть ключ. «Ключ» – это специальный строковый атрибут, который вам необходимо добавлять при создании списка элементов. Мы обсудим почему это важно в следующей главе.

Let's assign a `key` to our list items inside `numbers.map()` and fix the missing key issue.
Добавим `key` к нашему списку элементов внутри `numbers.map()` и поправим проблему его отсутствия.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

проблему его отсутствия

слишком сложно звучит

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

@gaearon а можно совет как лучше? В оригинале написано так:

and fix the missing key issue

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Чтобы исправить проблему с неуказанными ключами, добавим каждому элементу в списке атрибут key.

Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
@lex111lex111 added the work in progress Author opened the pull-request but it's still being worked on label Feb 10, 2019
Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
Когда вы запустите данный код, то увидите предупреждение о том, что у каждого элемента массива должен быть ключ. «Ключ» – это специальный строковый атрибут, который вам необходимо добавлять при создании списка элементов. Мы обсудим почему это важно в следующей главе.

Let's assign a `key` to our list items inside `numbers.map()` and fix the missing key issue.
Добавим `key` к нашему списку элементов внутри `numbers.map()` и поправим проблему его отсутствия.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Чтобы исправить проблему с неуказанными ключами, добавим каждому элементу в списке атрибут key.

Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
Comment threadcontent/docs/lists-and-keys.md Outdated
Вы можете создавать коллекции элементов и [включать их в JSX](/docs/introducing-jsx.html#embedding-expressions-in-jsx) с помощью фигурных скобок `{}`.

Below, we loop through the `numbers` array using the JavaScript [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) function. We return a `<li>` element for each item. Finally, we assign the resulting array of elements to `listItems`:
Ниже, мы проходим по массиву `numbers`, используя функцию JavaScript [`map()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map), и возвращаем элемент `<li>` в каждой итерации. Получившийся массив элементов мы сохраним в `listItems`:

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.

Ниже, мы

Лишняя запятая

Comment threadcontent/docs/lists-and-keys.md Outdated
Как правило, элементам внутри `map()` нужны ключи.

### Keys Must Only Be Unique Among Siblings {#keys-must-only-be-unique-among-siblings}
### Ключи должны быть уникальными среди соседей {#keys-must-only-be-unique-among-siblings}

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.

Siblings
соседей

Может быть, одноуровневыми элементами?

Comment threadcontent/docs/lists-and-keys.md Outdated
[**Try it on CodePen**](https://codepen.io/gaearon/pen/GjPyQr?editors=0011)

This code displays a bullet list of numbers between 1 and 5.
Этот код выведет ненумерованный список с числами от 1 до 5.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"ненумерованный список с числами" звучит странно. Тут буллет-поинты это не важная часть повествования и скорее только сбивает с толку. Можно просто "список".

Comment threadcontent/docs/lists-and-keys.md Outdated
Как правило, вы будете рендерить списки внутри какого-нибудь [компонента](/docs/components-and-props.html).

We can refactor the previous example into a component that accepts an array of `numbers` and outputs an unordered list of elements.
Мы можем отрефакторить предыдущий пример с использованием компонента, который принимает массив `numbers` и выводит неупорядоченный список элементов.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Та же проблема. Я убрал unordered из оригинального текста только что, так что просто "список" ок

Comment threadcontent/docs/lists-and-keys.md Outdated
```

When you run this code, you'll be given a warning that a key should be provided for list items. A "key" is a special string attribute you need to include when creating lists of elements. We'll discuss why it's important in the next section.
Когда вы запустите данный код, то увидите предупреждение о том, что у каждого элемента массива должен быть ключ (key). «Ключ» – это специальный строковый атрибут, который вам необходимо добавлять при создании списка элементов. Мы обсудим почему это важно ниже на странице.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Отбить запятыми "почему это важно"

Comment threadcontent/docs/lists-and-keys.md Outdated
## Ключи {#keys}

Keys help React identify which items have changed, are added, or are removed. Keys should be given to the elements inside the array to give the elements a stable identity:
Ключи помогают React определять какие элементы были изменены, добавлены или удалены. Ключи нужно присваивать элементам внутри массива для их явной идентификации:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Запятая перед какие

Comment threadcontent/docs/lists-and-keys.md Outdated
## Ключи {#keys}

Keys help React identify which items have changed, are added, or are removed. Keys should be given to the elements inside the array to give the elements a stable identity:
Ключи помогают React определять какие элементы были изменены, добавлены или удалены. Ключи нужно присваивать элементам внутри массива для их явной идентификации:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ключи нужно присваивать элементам внутри массива для их явной идентификации:

Identity это не идентификация, а идентичность. Stable тоже важно как-то передать (это не "явная").

Я бы по-другому переписал:

Их нужно указывать, чтобы React смог сопоставлять элементы между массивами с течением времени.

**Example: Correct Key Usage**
**Пример правильного использования ключей**

```javascript{2,3,9,10}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

тут комментарии не переведены

Comment threadcontent/docs/lists-and-keys.md Outdated
### Ключи должны быть уникальными среди соседей {#keys-must-only-be-unique-among-siblings}

Keys used within arrays should be unique among their siblings. However they don't need to be globally unique. We can use the same keys when we produce two different arrays:
Ключам, которые используются в массивах, нужно быть уникальными среди своих соседей. Однако они не должны быть уникальными глобально. Мы можем использовать одни и те же ключи для создания двух разных массивов.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ключам, которые используются в массивах, нужно быть уникальными среди своих соседей. Однако они не должны быть уникальными глобально. Мы можем использовать одни и те же ключи для создания двух разных массивов.

Ключи внутри массива должны быть уникальны только среди своих соседей. Им не нужно быть глобально уникальными. Можно использовать один и тот же ключ в двух разных массивах:

Comment threadcontent/docs/lists-and-keys.md Outdated
[**Try it on CodePen**](https://codepen.io/gaearon/pen/NRZYGN?editors=0010)

Keys serve as a hint to React but they don't get passed to your components. If you need the same value in your component, pass it explicitly as a prop with a different name:
Ключи являются подсказками для React, но они никогда не передаются в ваши компоненты. Если в компоненте нужно тоже самое значение, то передайте его явно через проп с другим именем:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

служат подсказками

"то же самое"

Comment threadcontent/docs/lists-and-keys.md Outdated
```

JSX allows [embedding any expression](/docs/introducing-jsx.html#embedding-expressions-in-jsx) in curly braces so we could inline the `map()` result:
JSX позволяет [встроить любое выражение](/docs/introducing-jsx.html#embedding-expressions-in-jsx) в фигурные скобки, так мы можем включить результат `map()`:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"так что"?

Comment threadcontent/docs/lists-and-keys.md Outdated
[**Try it on CodePen**](https://codepen.io/gaearon/pen/BLvYrB?editors=0010)

Sometimes this results in clearer code, but this style can also be abused. Like in JavaScript, it is up to you to decide whether it is worth extracting a variable for readability. Keep in mind that if the `map()` body is too nested, it might be a good time to [extract a component](/docs/components-and-props.html#extracting-components).
Иногда это приводит к более чистому коду, но бывает и наоборот. Как и в любом JavaScript-коде, вам придется самостоятельно решать стоит ли извлекать код в переменную для читабельности. Держите в голове, что если содержимое `map()` является слишком сложным, вероятно это отличная возможность чтобы . Не забывайте, что если код внутри `map()` слишком громоздкий, имеет смысл [извлечь его в отдельный компонент](/docs/components-and-props.html#extracting-components).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

запятая перед стоит

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"Держите в голове" осталось старое предложение

@gaearon
gaearon merged commit 07c9942 into reactjs:masterFeb 12, 2019
@gaearon

Copy link
Copy Markdown
Member

Поправил пару мелочей. Спасибо!

agoldis added a commit to agoldis/ru.reactjs.org that referenced this pull request Feb 12, 2019
* upstream/master: (108 commits)
Update nav
Translation List and keys (reactjs#64)
Translate "State and Lifecycle" (state-and-lifecycle.md) (reactjs#42)
Add the term fallback
Update getting-started.md
Update getting-started.md
Update TRANSLATION.md
Update getting-started.md
Update getting-started.md
Update TRANSLATION.md
Терминология: уборка
Исправить Условный рендеринг в нав панели
Пропущенное исправление в conditional-rendering
Терминология: code splitting
Терминология: helper
Терминология child [component]
Упорядочить глоссарий по алфавиту
Больше исправлений по замечаниям касательно conditional-rendering
Исправил PR-замечания про conditional-rendering.md
Translate "Conditional Rendering" into Russian
...
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

work in progressAuthor opened the pull-request but it's still being worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Windrushfarer@gaearon@lex111