-
-
Notifications
You must be signed in to change notification settings - Fork 839
i18n(ru): update some translations #2895
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
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
05c45e2
Update ru/guides/i18n.mdx
dragomano ba81ce9
Update ru/guides/sidebar.mdx
dragomano 4a6e362
Update ru/guides/overriding-components.mdx
dragomano 4fd9495
Update ru/resources/plugins.mdx
dragomano d3ace8b
Update ru/reference/configuration.mdx
dragomano afaf8f5
Update ru/reference/overrides.md
dragomano 1bd4884
Update ru/reference/plugins.md
dragomano 6559c5f
Fix broken links
dragomano 1c23204
Update some files
dragomano 0d83eb8
Merge branch 'main' into update_russian
delucis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,12 +36,11 @@ import { Steps } from '@astrojs/starlight/components'; | |
| ```astro | ||
| --- | ||
| // src/components/EmailLink.astro | ||
| import type { Props } from '@astrojs/starlight/props'; | ||
|
|
||
| const email = '[email protected]'; | ||
| --- | ||
|
|
||
| <a href="mailto:[email protected]"> | ||
| Связаться с нами по электронной почте | ||
| </a> | ||
| <a href=`mailto:${email}`>Напишите мне</a> | ||
| ``` | ||
|
|
||
| 3. Сообщите Starlight, что нужно использовать ваш компонент, указав его в параметре конфигурации [`components`](/ru/reference/configuration/#components) в `astro.config.mjs`: | ||
|
|
@@ -72,52 +71,46 @@ import { Steps } from '@astrojs/starlight/components'; | |
|
|
||
| Пример ниже показывает компонент, который отображает ссылку на электронную почту наряду со стандартным компонентом `SocialIcons`: | ||
|
|
||
| ```astro {4,8} | ||
| ```astro {3,7} | ||
| --- | ||
| // src/components/EmailLink.astro | ||
| import type { Props } from '@astrojs/starlight/props'; | ||
| import Default from '@astrojs/starlight/components/SocialIcons.astro'; | ||
| --- | ||
|
|
||
| <a href="mailto:[email protected]"> Связаться с нами по электронной почте </a> | ||
| <Default {...Astro.props}><slot /></Default> | ||
| <Default><slot /></Default> | ||
| ``` | ||
|
|
||
| При использовании встроенного компонента внутри вашего компонента: | ||
|
|
||
| - Передайте в него `Astro.props`. Это гарантирует, что он получит все данные, необходимые для отображения. | ||
| - Добавьте [`<slot />`](https://docs.astro.build/ru/basics/astro-components/#slots) внутрь компонента по умолчанию. Это гарантирует, что если компоненту передаются какие-либо дочерние элементы, Astro знает, где их отображать. | ||
| При рендеринге встроенного компонента внутри пользовательского компонента добавьте [`<slot />`](https://docs.astro.build/ru/basics/astro-components/#%D1%81%D0%BB%D0%BE%D1%82%D1%8B) внутрь компонента по умолчанию. Это гарантирует, что если компоненту переданы дочерние элементы, Astro будет знать, где их отобразить. | ||
|
|
||
| Если вы повторно используете компоненты [`PageFrame`](/ru/reference/overrides/#pageframe) или [`TwoColumnContent`](/ru/reference/overrides/#twocolumncontent), содержащие [именованные слоты](https://docs.astro.build/ru/basics/astro-components/#именованые-слоты), вам также необходимо [перенести](https://docs.astro.build/ru/basics/astro-components/#перенос-слотов) эти слоты. | ||
|
|
||
| Ниже показан пользовательский компонент, который повторно использует компонент `TwoColumnContent`, содержащий дополнительный именованный слот `right-sidebar`, нуждающийся в переносе: | ||
|
|
||
| ```astro {9} | ||
| ```astro {8} | ||
| --- | ||
| // src/components/CustomContent.astro | ||
| import type { Props } from '@astrojs/starlight/props'; | ||
| import Default from '@astrojs/starlight/components/TwoColumnContent.astro'; | ||
| --- | ||
|
|
||
| <Default {...Astro.props}> | ||
| <Default> | ||
| <slot /> | ||
| <slot name="right-sidebar" slot="right-sidebar" /> | ||
| </Default> | ||
| ``` | ||
|
|
||
| ## Использование данных страницы | ||
|
|
||
| При переопределении компонента Starlight ваша реализация получает стандартный объект `Astro.props`, содержащий все данные для текущей страницы. | ||
| При переопределении компонента Starlight вы можете получить доступ к глобальному объекту [`starlightRoute`](/ru/guides/route-data/), который содержит все данные для текущей страницы. | ||
| Это позволяет вам использовать эти значения для управления тем, как ваш компонент будет отображаться. | ||
|
|
||
| Например, вы можете прочитать метаданные страницы как `Astro.props.entry.data`. В следующем примере компонент [`PageTitle`](/ru/reference/overrides/#pagetitle) использует этот объект для отображения текущего заголовка страницы: | ||
| В следующем примере заменяющий компонент [`PageTitle`](/ru/reference/overrides/#pagetitle) отображает заголовок текущей страницы, установленный в метаданных контента: | ||
|
|
||
| ```astro {5} "{title}" | ||
| ```astro {4} "{title}" | ||
| --- | ||
| // src/components/Title.astro | ||
| import type { Props } from '@astrojs/starlight/props'; | ||
|
|
||
| const { title } = Astro.props.entry.data; | ||
| const { title } = Astro.locals.starlightRoute.entry.data; | ||
| --- | ||
|
|
||
| <h1 id="_top">{title}</h1> | ||
|
|
@@ -129,32 +122,31 @@ const { title } = Astro.props.entry.data; | |
| </style> | ||
| ``` | ||
|
|
||
| Узнайте больше обо всех доступных свойствах в [Справочнике по переопределениям](/ru/reference/overrides/#параметры-компонентов). | ||
| Узнайте больше обо всех доступных свойствах в [Справочнике по данным маршрута](/ru/reference/route-data/). | ||
|
|
||
| ### Переопределение только на определённых страницах | ||
|
|
||
| Переопределение компонентов применяется ко всем страницам. Тем не менее, вы можете осуществлять условную отрисовку, используя значения из `Astro.props`, чтобы определить, когда показывать ваш интерфейс, когда показывать интерфейс Starlight, или даже когда показывать что-то совершенно другое. | ||
| Переопределение компонентов применяется ко всем страницам. Тем не менее, вы можете осуществлять условную отрисовку, используя значения из `starlightRoute`, чтобы определить, когда показывать ваш интерфейс, когда показывать интерфейс Starlight, или даже когда показывать что-то совершенно другое. | ||
|
|
||
| В следующем примере компонент, переопределяющий [`Footer`](/ru/reference/overrides/#footer) от Starlight, отображает надпись «Создано с помощью Starlight 🌟» только на главной странице, а на всех остальных страницах показывает футер по умолчанию: | ||
|
|
||
| ```astro | ||
| --- | ||
| // src/components/ConditionalFooter.astro | ||
| import type { Props } from '@astrojs/starlight/props'; | ||
| import Default from '@astrojs/starlight/components/Footer.astro'; | ||
|
|
||
| const isHomepage = Astro.props.slug === ''; | ||
| const isHomepage = Astro.locals.starlightRoute.id === ''; | ||
| --- | ||
|
|
||
| { | ||
| isHomepage ? ( | ||
| <footer>Создано с помощью Starlight 🌟</footer> | ||
| ) : ( | ||
| <Default {...Astro.props}> | ||
| <Default> | ||
| <slot /> | ||
| </Default> | ||
| ) | ||
| } | ||
| ``` | ||
|
|
||
| Узнайте больше об условной отрисовке в руководстве [Синтаксис Astro](https://docs.astro.build/ru/basics/astro-syntax/#динамический-html). | ||
| Узнайте больше об отрисовке по условию в руководстве [Синтаксис Astro](https://docs.astro.build/ru/basics/astro-syntax/#динамический-html). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.