diff --git a/.cspell-dict b/.cspell-dict index 995d1d2..86d3dff 100644 --- a/.cspell-dict +++ b/.cspell-dict @@ -19,6 +19,7 @@ Vorobyovy Notimaps retromap Godina +Rehype # ru-ru ватермарки diff --git a/docusaurus.config.js b/docusaurus.config.js index e0d7e89..e17bc7b 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1,14 +1,31 @@ // @ts-check // Note: type annotations allow type checking and IDEs autocompletion +import ConfigLocalized from './docusaurus.config.localized.json'; const {themes} = require('prism-react-renderer'); const lightCodeTheme = themes.github; const darkCodeTheme = themes.dracula; +const defaultLocale = 'ru'; + +function getLocalizedConfigValue(key) { + const currentLocale = process.env.DOCUSAURUS_CURRENT_LOCALE ?? defaultLocale; + const values = ConfigLocalized[key]; + if (!values) { + throw new Error(`Localized config key=${key} not found`); + } + const value = values[currentLocale] ?? values[defaultLocale]; + if (!value) { + throw new Error( + `Localized value for config key=${key} not found for both currentLocale=${currentLocale} or defaultLocale=${defaultLocale}`, + ); + } + return value; +} /** @type {import('@docusaurus/types').Config} */ const config = { - title: 'PastVu Resources', - tagline: 'PastVu is an online platform for gathering, geo-tagging, attributing and discussing retro photos.', + title: getLocalizedConfigValue('title'), + tagline: getLocalizedConfigValue('tagline'), url: 'https://docs.pastvu.com', baseUrl: '/', onBrokenLinks: 'throw', @@ -20,7 +37,7 @@ const config = { // metadata like html lang. For example, if your site is Chinese, you may want // to replace "en" with "zh-Hans". i18n: { - defaultLocale: 'ru', + defaultLocale: defaultLocale, locales: ['en', 'ru'], localeConfigs: { en: { @@ -31,6 +48,11 @@ const config = { }, }, }, + markdown: { + remarkRehypeOptions: { + footnoteLabel: getLocalizedConfigValue('remarkRehypeOptions_footnotes'), + }, + }, plugins: ['docusaurus-plugin-sass', ["@docusaurus/plugin-client-redirects", { @@ -111,7 +133,7 @@ const config = { ], }, footer: { - copyright: `© ${new Date().getFullYear()} PastVu documentation. Built with Docusaurus.`, // Not in use, see i18n/en/docusaurus-theme-classic/footer.json + copyright: `© ${new Date().getFullYear()} ` + getLocalizedConfigValue('footer_copyright'), // Not in use, see i18n/en/docusaurus-theme-classic/footer.json }, prism: { theme: lightCodeTheme, diff --git a/docusaurus.config.localized.json b/docusaurus.config.localized.json new file mode 100644 index 0000000..bd2e26b --- /dev/null +++ b/docusaurus.config.localized.json @@ -0,0 +1,18 @@ +{ + "title": { + "en": "PastVu Resources", + "ru": "База знаний PastVu" + }, + "tagline": { + "en": "PastVu is an online platform for gathering, geo-tagging, attributing and discussing retro photos", + "ru": "Проект по сбору свидетельств прошлого в фотографиях, взгляд на историю среды обитания человечества" + }, + "remarkRehypeOptions_footnotes": { + "en": "Footnotes", + "ru": "Примечания" + }, + "footer_copyright": { + "en": "PastVu documentation. Built with Docusaurus. Content is licensed under CC-BY 4.0.", + "ru": "База знаний PastVu. Сделано на Docusaurus. Материал этого сайта доступен по лицензии CC-BY 4.0." + } +} diff --git a/i18n/en/docusaurus-theme-classic/footer.json b/i18n/en/docusaurus-theme-classic/footer.json deleted file mode 100644 index e38848c..0000000 --- a/i18n/en/docusaurus-theme-classic/footer.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "copyright": { - "message": "© 2023 PastVu documentation. Built with Docusaurus. Content is licensed under CC-BY 4.0.", - "description": "The footer copyright" - } -} diff --git a/i18n/ru/docusaurus-theme-classic/footer.json b/i18n/ru/docusaurus-theme-classic/footer.json deleted file mode 100644 index 1213872..0000000 --- a/i18n/ru/docusaurus-theme-classic/footer.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "copyright": { - "message": "© 2023 База знаний PastVu. Сделано на Docusaurus. Материал этого сайта доступен по лицензии CC-BY 4.0.", - "description": "The footer copyright" - } -} diff --git a/yarn.lock b/yarn.lock index 0580658..8526a25 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4167,14 +4167,9 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001538, caniuse-lite@^1.0.30001541, caniuse-lite@^1.0.30001646, caniuse-lite@^1.0.30001663: - version "1.0.30001667" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001667.tgz" - integrity sha512-7LTwJjcRkzKFmtqGsibMeuXmvFDfZq/nzIjnmgCGzKKRVzjD72selLDK1oPF/Oxzmt4fNcPvTDvGqSDG4tCALw== - -caniuse-lite@^1.0.30001754: +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001538, caniuse-lite@^1.0.30001541, caniuse-lite@^1.0.30001646, caniuse-lite@^1.0.30001663, caniuse-lite@^1.0.30001754: version "1.0.30001755" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001755.tgz#c01cfb1c30f5acf1229391666ec03492f4c332ff" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001755.tgz" integrity sha512-44V+Jm6ctPj7R52Na4TLi3Zri4dWUljJd+RDm+j8LtNCc/ihLCT+X1TzoOAkRETEWqjuLnh9581Tl80FvK7jVA== ccount@^2.0.0: