Skip to content

Commit

Permalink
docs(ru): add Russian translation (#3709)
Browse files Browse the repository at this point in the history
Co-authored-by: Ruslan Makarov <ruslan.makarov@gmail.com>
  • Loading branch information
dragomano and altrusl authored Apr 7, 2024
1 parent 3113dad commit 5832402
Show file tree
Hide file tree
Showing 41 changed files with 7,020 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/.vitepress/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { shared } from './shared'
import { en } from './en'
import { zh } from './zh'
import { pt } from './pt'
import { ru } from './ru'

export default defineConfig({
...shared,
locales: {
root: { label: 'English', ...en },
zh: { label: '简体中文', ...zh },
pt: { label: 'Português', ...pt },
ru: { label: 'Русский', ...ru },
ko: { label: '한국어', lang: 'ko-KR', link: 'https://vitepress.vuejs.kr/' }
}
})
208 changes: 208 additions & 0 deletions docs/.vitepress/config/ru.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
import { createRequire } from 'module'
import { defineConfig, type DefaultTheme } from 'vitepress'

const require = createRequire(import.meta.url)
const pkg = require('vitepress/package.json')

export const ru = defineConfig({
lang: 'ru-RU',
description: 'Генератор статических сайтов на основе Vite и Vue.',

themeConfig: {
nav: nav(),

sidebar: {
'/ru/guide/': { base: '/ru/guide/', items: sidebarGuide() },
'/ru/reference/': { base: '/ru/reference/', items: sidebarReference() }
},

editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
text: 'Редактировать страницу'
},

footer: {
message: 'Опубликовано под лицензией MIT.',
copyright: '© 2019 – настоящее время, Эван Ю'
},

outline: { label: 'Содержание страницы' },

docFooter: {
prev: 'Предыдущая страница',
next: 'Следующая страница'
},

lastUpdated: {
text: 'Обновлено'
},

darkModeSwitchLabel: 'Оформление',
lightModeSwitchTitle: 'Переключить на светлую тему',
darkModeSwitchTitle: 'Переключить на тёмную тему',
sidebarMenuLabel: 'Меню',
returnToTopLabel: 'Вернуться к началу',
langMenuLabel: 'Изменить язык'
}
})

function nav(): DefaultTheme.NavItem[] {
return [
{
text: 'Руководство',
link: '/ru/guide/what-is-vitepress',
activeMatch: '/ru/guide/'
},
{
text: 'Справочник',
link: '/ru/reference/site-config',
activeMatch: '/ru/reference/'
},
{
text: pkg.version,
items: [
{
text: 'Изменения',
link: 'https://github.com/vuejs/vitepress/blob/main/CHANGELOG.md'
},
{
text: 'Вклад',
link: 'https://github.com/vuejs/vitepress/blob/main/.github/contributing.md'
}
]
}
]
}

function sidebarGuide(): DefaultTheme.SidebarItem[] {
return [
{
text: 'Введение',
collapsed: false,
items: [
{ text: 'Что такое VitePress?', link: 'what-is-vitepress' },
{ text: 'Первые шаги', link: 'getting-started' },
{ text: 'Маршрутизация', link: 'routing' },
{ text: 'Развёртывание', link: 'deploy' }
]
},
{
text: 'Написание',
collapsed: false,
items: [
{ text: 'Расширения Markdown', link: 'markdown' },
{ text: 'Обработка ресурсов', link: 'asset-handling' },
{ text: 'Метаданные', link: 'frontmatter' },
{ text: 'Использование Vue в Markdown', link: 'using-vue' },
{ text: 'Интернационализация', link: 'i18n' }
]
},
{
text: 'Настройка',
collapsed: false,
items: [
{ text: 'Пользовательская тема', link: 'custom-theme' },
{
text: 'Расширение темы по умолчанию',
link: 'extending-default-theme'
},
{
text: 'Загрузка данных в режиме реального времени',
link: 'data-loading'
},
{ text: 'Совместимость с SSR', link: 'ssr-compat' },
{ text: 'Подключение к CMS', link: 'cms' }
]
},
{
text: 'Экспериментально',
collapsed: false,
items: [
{ text: 'Режим MPA', link: 'mpa-mode' },
{ text: 'Генерация карты сайта', link: 'sitemap-generation' }
]
},
{ text: 'Конфигурация и API', base: '/ru/reference/', link: 'site-config' }
]
}

function sidebarReference(): DefaultTheme.SidebarItem[] {
return [
{
text: 'Справочник',
items: [
{ text: 'Конфигурация сайта', link: 'site-config' },
{ text: 'Конфигурация метаданных', link: 'frontmatter-config' },
{ text: 'Runtime API', link: 'runtime-api' },
{ text: 'Командная строка', link: 'cli' },
{
text: 'Тема по умолчанию',
base: '/ru/reference/default-theme-',
items: [
{ text: 'Обзор', link: 'config' },
{ text: 'Навигация', link: 'nav' },
{ text: 'Сайдбар', link: 'sidebar' },
{ text: 'Главная страница', link: 'home-page' },
{ text: 'Подвал', link: 'footer' },
{ text: 'Макет', link: 'layout' },
{ text: 'Значки', link: 'badge' },
{ text: 'Страница команды', link: 'team-page' },
{
text: 'Предыдущая и следующая страницы',
link: 'prev-next-links'
},
{ text: 'Ссылка для редактирования', link: 'edit-link' },
{ text: 'Последнее обновление', link: 'last-updated' },
{ text: 'Поиск', link: 'search' },
{ text: 'Carbon Ads (реклама)', link: 'carbon-ads' }
]
}
]
}
]
}

export const search: DefaultTheme.AlgoliaSearchOptions['locales'] = {
ru: {
placeholder: 'Поиск в документации',
translations: {
button: {
buttonText: 'Поиск',
buttonAriaLabel: 'Поиск'
},
modal: {
searchBox: {
resetButtonTitle: 'Сбросить поиск',
resetButtonAriaLabel: 'Сбросить поиск',
cancelButtonText: 'Отменить поиск',
cancelButtonAriaLabel: 'Отменить поиск'
},
startScreen: {
recentSearchesTitle: 'История поиска',
noRecentSearchesText: 'Нет истории поиска',
saveRecentSearchButtonTitle: 'Сохранить в истории поиска',
removeRecentSearchButtonTitle: 'Удалить из истории поиска',
favoriteSearchesTitle: 'Избранное',
removeFavoriteSearchButtonTitle: 'Удалить из избранного'
},
errorScreen: {
titleText: 'Невозможно получить результаты',
helpText: 'Вам может потребоваться проверить подключение к Интернету'
},
footer: {
selectText: 'выбрать',
navigateText: 'перейти',
closeText: 'закрыть',
searchByText: 'поставщик поиска'
},
noResultsScreen: {
noResultsText: 'Нет результатов для',
suggestedQueryText: 'Вы можете попытаться узнать',
reportMissingResultsText:
'Считаете, что поиск даёт ложные результаты?',
reportMissingResultsLinkText: 'Нажмите на кнопку «Обратная связь»'
}
}
}
}
}
3 changes: 2 additions & 1 deletion docs/.vitepress/config/shared.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig } from 'vitepress'
import { search as zhSearch } from './zh'
import { search as ptSearch } from './pt'
import { search as ruSearch } from './ru'

export const shared = defineConfig({
title: 'VitePress',
Expand Down Expand Up @@ -55,7 +56,7 @@ export const shared = defineConfig({
appId: '8J64VVRP8K',
apiKey: 'a18e2f4cc5665f6602c5631fd868adfd',
indexName: 'vitepress',
locales: { ...zhSearch, ...ptSearch }
locales: { ...zhSearch, ...ptSearch, ...ruSearch }
}
},

Expand Down
6 changes: 5 additions & 1 deletion docs/lunaria.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"files": [
{
"location": ".vitepress/config/{en,zh,pt}.ts",
"location": ".vitepress/config/{en,zh,pt,ru}.ts",
"pattern": ".vitepress/config/@lang.ts",
"type": "universal"
},
Expand All @@ -28,6 +28,10 @@
{
"label": "Português",
"lang": "pt"
},
{
"label": "Русский",
"lang": "ru"
}
],
"outDir": ".vitepress/dist/_translations",
Expand Down
80 changes: 80 additions & 0 deletions docs/ru/components/ModalDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<script setup lang="ts">
import { ref } from 'vue'
const showModal = ref(false)
</script>

<template>
<button class="modal-button" @click="showModal = true">
Показать модальное окно
</button>

<Teleport to="body">
<Transition name="modal">
<div v-show="showModal" class="modal-mask">
<div class="modal-container">
<p>Привет из модального окна!</p>
<div class="model-footer">
<button class="modal-button" @click="showModal = false">
Закрыть
</button>
</div>
</div>
</div>
</Transition>
</Teleport>
</template>

<style scoped>
.modal-mask {
position: fixed;
z-index: 200;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
transition: opacity 0.3s ease;
}
.modal-container {
width: 300px;
margin: auto;
padding: 20px 30px;
background-color: var(--vp-c-bg);
border-radius: 2px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.33);
transition: all 0.3s ease;
}
.model-footer {
margin-top: 8px;
text-align: right;
}
.modal-button {
padding: 4px 8px;
border-radius: 4px;
border-color: var(--vp-button-alt-border);
color: var(--vp-button-alt-text);
background-color: var(--vp-button-alt-bg);
}
.modal-button:hover {
border-color: var(--vp-button-alt-hover-border);
color: var(--vp-button-alt-hover-text);
background-color: var(--vp-button-alt-hover-bg);
}
.modal-enter-from,
.modal-leave-to {
opacity: 0;
}
.modal-enter-from .modal-container,
.modal-leave-to .modal-container {
transform: scale(1.1);
}
</style>
Loading

0 comments on commit 5832402

Please # to comment.