Skip to content

Commit

Permalink
i18n(ru): update i18n.mdx and overriding-components.mdx (#2557)
Browse files Browse the repository at this point in the history
Co-authored-by: HiDeoo <[email protected]>
  • Loading branch information
dragomano and HiDeoo authored Nov 2, 2024
1 parent 43041ee commit 183c9c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/src/content/docs/ru/guides/i18n.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -393,12 +393,13 @@ const arabicDirection = Astro.locals.t.dir('ar');

Вы можете использовать [`Astro.currentLocale`](https://docs.astro.build/ru/reference/api-reference/#astrocurrentlocale) для получения текущей локали в компонентах `.astro`.

Следующий пример считывает текущую локаль и использует её для создания ссылки на страницу о сайте на текущем языке:
Следующий пример считывает текущую локаль и использует её с помощью хелпера [`getRelativeLocaleUrl()`](https://docs.astro.build/ru/reference/modules/astro-i18n/#getrelativelocaleurl) для генерации ссылки на страницу «О сайте» на текущем языке:

```astro
---
// src/components/AboutLink.astro
import { getRelativeLocaleUrl } from 'astro:i18n';
---
<a href={`/${Astro.currentLocale}/about`}>О сайте</a>
<a href={getRelativeLocaleUrl(Astro.currentLocale ?? 'en', 'about')}>О сайте</a>
```
4 changes: 4 additions & 0 deletions docs/src/content/docs/ru/guides/overriding-components.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ import { Steps } from '@astrojs/starlight/components';
1. Выберите компонент Starlight, который вы хотите переопределить.
Вы можете найти полный список компонентов в [Справочнике по переопределениям](/ru/reference/overrides/).

:::tip
Не уверены, какой компонент нужно переопределить? Используйте [интерактивную карту переопределений Starlight](https://starlight-overrides-map.netlify.app/), чтобы узнать названия UI-компонентов Starlight.
:::

В этом примере будет переопределён компонент [`SocialIcons`](/ru/reference/overrides/#socialicons) в навигационной панели страницы.

2. Создайте компонент Astro для замены компонента Starlight.
Expand Down

0 comments on commit 183c9c7

Please sign in to comment.