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

Translation List and keys #64

Merged
merged 4 commits into from
Feb 12, 2019
Merged

Conversation

Windrushfarer
Copy link
Contributor

No description provided.

@Windrushfarer Windrushfarer mentioned this pull request Feb 10, 2019
88 tasks
content/docs/lists-and-keys.md Outdated Show resolved Hide resolved
content/docs/lists-and-keys.md Outdated Show resolved Hide resolved

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

Choose a reason for hiding this comment

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

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

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

Copy link
Contributor Author

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
Member

Choose a reason for hiding this comment

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

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

content/docs/lists-and-keys.md Outdated Show resolved Hide resolved
content/docs/lists-and-keys.md Outdated Show resolved Hide resolved
@lex111 lex111 added the work in progress Author opened the pull-request but it's still being worked on label Feb 10, 2019
content/docs/lists-and-keys.md Outdated Show resolved Hide resolved
content/docs/lists-and-keys.md Outdated Show resolved Hide resolved
content/docs/lists-and-keys.md Outdated Show resolved Hide resolved
content/docs/lists-and-keys.md Outdated Show resolved Hide resolved
content/docs/lists-and-keys.md Outdated Show resolved Hide resolved

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

Choose a reason for hiding this comment

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

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

content/docs/lists-and-keys.md Outdated Show resolved Hide resolved
content/docs/lists-and-keys.md Outdated Show resolved Hide resolved
content/docs/lists-and-keys.md Outdated Show resolved Hide resolved
content/docs/lists-and-keys.md Outdated Show resolved Hide resolved

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
Member

Choose a reason for hiding this comment

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

Ниже, мы

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


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

Choose a reason for hiding this comment

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

Siblings
соседей

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

@@ -44,13 +44,13 @@ ReactDOM.render(

[**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
Member

Choose a reason for hiding this comment

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

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


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
Member

Choose a reason for hiding this comment

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

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

@@ -70,9 +70,9 @@ ReactDOM.render(
);
```

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
Member

Choose a reason for hiding this comment

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

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


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
Member

Choose a reason for hiding this comment

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

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


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
Member

Choose a reason for hiding this comment

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

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

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

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

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

@@ -173,7 +173,7 @@ ReactDOM.render(
);
```

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

```javascript{2,3,9,10}
Copy link
Member

Choose a reason for hiding this comment

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

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


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
Member

Choose a reason for hiding this comment

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

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

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

@@ -248,7 +248,7 @@ ReactDOM.render(

[**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
Member

Choose a reason for hiding this comment

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

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

"то же самое"

@@ -280,7 +280,7 @@ function NumberList(props) {
}
```

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
Member

Choose a reason for hiding this comment

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

"так что"?

@@ -298,4 +298,4 @@ function NumberList(props) {

[**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
Member

Choose a reason for hiding this comment

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

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

Copy link
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:master Feb 12, 2019
@gaearon
Copy link
Member

gaearon commented Feb 12, 2019

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

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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work in progress Author opened the pull-request but it's still being worked on
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants