From 45c0f6dd302ab2c0c2e1bcb23db261d13caf1547 Mon Sep 17 00:00:00 2001 From: Tine Jozelj Date: Tue, 12 Sep 2023 18:27:00 +0200 Subject: [PATCH] feat: translations --- docusaurus.config.js | 5 + i18n/en/code.json | 62 ++++ .../current.json | 12 - i18n/en/docusaurus-theme-classic/footer.json | 24 +- i18n/en/docusaurus-theme-classic/navbar.json | 10 +- i18n/sl/code.json | 335 ++++++++++++++++++ i18n/sl/docusaurus-theme-classic/footer.json | 26 ++ i18n/sl/docusaurus-theme-classic/navbar.json | 14 + .../NavbarItems/CustomStatusNavbarItem.tsx | 34 +- src/pages/index.tsx | 24 +- 10 files changed, 497 insertions(+), 49 deletions(-) create mode 100644 i18n/sl/code.json create mode 100644 i18n/sl/docusaurus-theme-classic/footer.json create mode 100644 i18n/sl/docusaurus-theme-classic/navbar.json diff --git a/docusaurus.config.js b/docusaurus.config.js index c733da2..5b8e12a 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -106,6 +106,11 @@ const config = { }, { to: "/blog", label: "Blog", position: "left" }, { type: "custom-status-navbar-item", position: "left" }, + + { + type: "search", + position: "right", + }, { type: "localeDropdown", position: "right", diff --git a/i18n/en/code.json b/i18n/en/code.json index ec91ab7..6947580 100644 --- a/i18n/en/code.json +++ b/i18n/en/code.json @@ -258,6 +258,41 @@ "message": "Expand sidebar", "description": "The ARIA label and title attribute for expand button of doc sidebar" }, + "theme.SearchPage.existingResultsTitle": { + "message": "Search results for \"{query}\"", + "description": "The search page title for non-empty query" + }, + "theme.SearchPage.emptyResultsTitle": { + "message": "Search the documentation", + "description": "The search page title for empty query" + }, + "theme.SearchPage.searchContext.everywhere": { + "message": "everywhere" + }, + "theme.SearchPage.documentsFound.plurals": { + "message": "1 document found|{count} documents found", + "description": "Pluralized label for \"{count} documents found\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.SearchPage.noResultsText": { + "message": "No documents were found", + "description": "The paragraph for empty search result" + }, + "theme.SearchBar.noResultsText": { + "message": "No results" + }, + "theme.SearchBar.seeAll": { + "message": "See all results" + }, + "theme.SearchBar.seeAllOutsideContext": { + "message": "See results outside {context}" + }, + "theme.SearchBar.searchInContext": { + "message": "See all results in {context}" + }, + "theme.SearchBar.label": { + "message": "Search", + "description": "The ARIA label and placeholder for search button" + }, "theme.ErrorPageContent.tryAgain": { "message": "Try again", "description": "The label of the button to try again rendering when the React error boundary captures an error" @@ -269,5 +304,32 @@ "theme.tags.tagsPageTitle": { "message": "Tags", "description": "The title of the tag list page" + }, + "navbar.status.ok": { + "message": "Ok", + "description": "Text representing ok status" + }, + "navbar.status.issues": { + "message": "Issues", + "description": "Text representing issues status" + }, + "navbar.status": { + "message": "Status", + "description": "Navbar item that links to status page" + }, + "home.signIn": { + "message": "Sign In" + }, + "home.requestAccess": { + "message": "Request Access" + }, + "home.descriptionTitle": { + "message": "What is this?" + }, + "home.descriptionContent": { + "message": "We are non-profit provider of cloud services for select public. Our goal is to provide well integrated and coherent suite of applications that can rival offers of propriatery and for-profit companies. We use and build on top of open source software." + }, + "home.tagline": { + "message": "Your personal space in the cloud." } } diff --git a/i18n/en/docusaurus-plugin-content-docs/current.json b/i18n/en/docusaurus-plugin-content-docs/current.json index 15bf47b..dd30528 100644 --- a/i18n/en/docusaurus-plugin-content-docs/current.json +++ b/i18n/en/docusaurus-plugin-content-docs/current.json @@ -2,17 +2,5 @@ "version.label": { "message": "Next", "description": "The label for version current" - }, - "sidebar.tutorialSidebar.category.Tutorial - Basics": { - "message": "Tutorial - Basics", - "description": "The label for category Tutorial - Basics in sidebar tutorialSidebar" - }, - "sidebar.tutorialSidebar.category.Tutorial - Basics.link.generated-index.description": { - "message": "5 minutes to learn the most important Docusaurus concepts.", - "description": "The generated-index page description for category Tutorial - Basics in sidebar tutorialSidebar" - }, - "sidebar.tutorialSidebar.category.Tutorial - Extras": { - "message": "Tutorial - Extras", - "description": "The label for category Tutorial - Extras in sidebar tutorialSidebar" } } diff --git a/i18n/en/docusaurus-theme-classic/footer.json b/i18n/en/docusaurus-theme-classic/footer.json index 290cefa..7be6b54 100644 --- a/i18n/en/docusaurus-theme-classic/footer.json +++ b/i18n/en/docusaurus-theme-classic/footer.json @@ -1,23 +1,23 @@ { - "link.title.Docs": { - "message": "Docs", - "description": "The title of the footer links column with title=Docs in the footer" + "link.title.Articles": { + "message": "Articles", + "description": "The title of the footer links column with title=Articles in the footer" }, "link.title.Community": { "message": "Community", "description": "The title of the footer links column with title=Community in the footer" }, - "link.item.label.Tutorial": { - "message": "Tutorial", - "description": "The label of footer link with label=Tutorial linking to /docs/intro" + "link.item.label.Documentation": { + "message": "Documentation", + "description": "The label of footer link with label=Documentation linking to /docs/home" }, - "link.item.label.Matrix Chat": { - "message": "Matrix Chat", - "description": "The label of footer link with label=Matrix Chat linking to https://matrix.to/#/#hello:tjo.space" + "link.item.label.Blog": { + "message": "Blog", + "description": "The label of footer link with label=Blog linking to /blog" }, - "link.item.label.Public Source Code": { - "message": "Public Source Code", - "description": "The label of footer link with label=Public Source Code linking to https://code.tjo.space/tjo-space" + "link.item.label.Matrix Room #hello:tjo.space": { + "message": "Matrix Room #hello:tjo.space", + "description": "The label of footer link with label=Matrix Room #hello:tjo.space linking to https://matrix.to/#/#hello:tjo.space" }, "copyright": { "message": "Copyright © 2023 tjo.space. Built with Docusaurus.", diff --git a/i18n/en/docusaurus-theme-classic/navbar.json b/i18n/en/docusaurus-theme-classic/navbar.json index 200bef7..8b07e29 100644 --- a/i18n/en/docusaurus-theme-classic/navbar.json +++ b/i18n/en/docusaurus-theme-classic/navbar.json @@ -3,16 +3,12 @@ "message": "tjo.space logo", "description": "The alt text of navbar logo" }, - "item.label.Tutorial": { - "message": "Tutorial", - "description": "Navbar item with label Tutorial" + "item.label.Documentation": { + "message": "Documentation", + "description": "Navbar item with label Documentation" }, "item.label.Blog": { "message": "Blog", "description": "Navbar item with label Blog" - }, - "item.label.Sign In": { - "message": "Sign In", - "description": "Navbar item with label Sign In" } } diff --git a/i18n/sl/code.json b/i18n/sl/code.json new file mode 100644 index 0000000..3c1c26c --- /dev/null +++ b/i18n/sl/code.json @@ -0,0 +1,335 @@ +{ + "theme.ErrorPageContent.title": { + "message": "This page crashed.", + "description": "The title of the fallback page when the page crashed" + }, + "theme.NotFound.title": { + "message": "Stran ni bila najdena.", + "description": "The title of the 404 page" + }, + "theme.NotFound.p1": { + "message": "Nismo našli kar iščete.", + "description": "The first paragraph of the 404 page" + }, + "theme.NotFound.p2": { + "message": "Prosimo kontaktirajte lastnika spletne strani, ki vas je poslala sem da je njihova povezava napacna.", + "description": "The 2nd paragraph of the 404 page" + }, + "theme.admonition.note": { + "message": "note", + "description": "The default label used for the Note admonition (:::note)" + }, + "theme.admonition.tip": { + "message": "tip", + "description": "The default label used for the Tip admonition (:::tip)" + }, + "theme.admonition.danger": { + "message": "danger", + "description": "The default label used for the Danger admonition (:::danger)" + }, + "theme.admonition.info": { + "message": "info", + "description": "The default label used for the Info admonition (:::info)" + }, + "theme.admonition.caution": { + "message": "caution", + "description": "The default label used for the Caution admonition (:::caution)" + }, + "theme.blog.archive.title": { + "message": "Archive", + "description": "The page & hero title of the blog archive page" + }, + "theme.blog.archive.description": { + "message": "Archive", + "description": "The page & hero description of the blog archive page" + }, + "theme.BackToTopButton.buttonAriaLabel": { + "message": "Scroll back to top", + "description": "The ARIA label for the back to top button" + }, + "theme.blog.paginator.navAriaLabel": { + "message": "Blog list page navigation", + "description": "The ARIA label for the blog pagination" + }, + "theme.blog.paginator.newerEntries": { + "message": "Newer Entries", + "description": "The label used to navigate to the newer blog posts page (previous page)" + }, + "theme.blog.paginator.olderEntries": { + "message": "Older Entries", + "description": "The label used to navigate to the older blog posts page (next page)" + }, + "theme.blog.post.paginator.navAriaLabel": { + "message": "Blog post page navigation", + "description": "The ARIA label for the blog posts pagination" + }, + "theme.blog.post.paginator.newerPost": { + "message": "Newer Post", + "description": "The blog post button label to navigate to the newer/previous post" + }, + "theme.blog.post.paginator.olderPost": { + "message": "Older Post", + "description": "The blog post button label to navigate to the older/next post" + }, + "theme.blog.post.plurals": { + "message": "One post|{count} posts", + "description": "Pluralized label for \"{count} posts\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.blog.tagTitle": { + "message": "{nPosts} tagged with \"{tagName}\"", + "description": "The title of the page for a blog tag" + }, + "theme.tags.tagsPageLink": { + "message": "View All Tags", + "description": "The label of the link targeting the tag list page" + }, + "theme.colorToggle.ariaLabel": { + "message": "Switch between dark and light mode (currently {mode})", + "description": "The ARIA label for the navbar color mode toggle" + }, + "theme.colorToggle.ariaLabel.mode.dark": { + "message": "dark mode", + "description": "The name for the dark color mode" + }, + "theme.colorToggle.ariaLabel.mode.light": { + "message": "light mode", + "description": "The name for the light color mode" + }, + "theme.docs.breadcrumbs.navAriaLabel": { + "message": "Breadcrumbs", + "description": "The ARIA label for the breadcrumbs" + }, + "theme.docs.DocCard.categoryDescription": { + "message": "{count} items", + "description": "The default description for a category card in the generated index about how many items this category includes" + }, + "theme.docs.paginator.navAriaLabel": { + "message": "Docs pages", + "description": "The ARIA label for the docs pagination" + }, + "theme.docs.paginator.previous": { + "message": "Previous", + "description": "The label used to navigate to the previous doc" + }, + "theme.docs.paginator.next": { + "message": "Next", + "description": "The label used to navigate to the next doc" + }, + "theme.docs.tagDocListPageTitle.nDocsTagged": { + "message": "One doc tagged|{count} docs tagged", + "description": "Pluralized label for \"{count} docs tagged\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.docs.tagDocListPageTitle": { + "message": "{nDocsTagged} with \"{tagName}\"", + "description": "The title of the page for a docs tag" + }, + "theme.docs.versionBadge.label": { + "message": "Version: {versionLabel}" + }, + "theme.docs.versions.unreleasedVersionLabel": { + "message": "This is unreleased documentation for {siteTitle} {versionLabel} version.", + "description": "The label used to tell the user that he's browsing an unreleased doc version" + }, + "theme.docs.versions.unmaintainedVersionLabel": { + "message": "This is documentation for {siteTitle} {versionLabel}, which is no longer actively maintained.", + "description": "The label used to tell the user that he's browsing an unmaintained doc version" + }, + "theme.docs.versions.latestVersionSuggestionLabel": { + "message": "For up-to-date documentation, see the {latestVersionLink} ({versionLabel}).", + "description": "The label used to tell the user to check the latest version" + }, + "theme.docs.versions.latestVersionLinkLabel": { + "message": "latest version", + "description": "The label used for the latest version suggestion link label" + }, + "theme.common.editThisPage": { + "message": "Uredi to stran", + "description": "The link label to edit the current page" + }, + "theme.common.headingLinkTitle": { + "message": "Direct link to {heading}", + "description": "Title for link to heading" + }, + "theme.lastUpdated.atDate": { + "message": "dne {date}", + "description": "The words used to describe on which date a page has been last updated" + }, + "theme.lastUpdated.byUser": { + "message": "{user}", + "description": "The words used to describe by who the page has been last updated" + }, + "theme.lastUpdated.lastUpdatedAtBy": { + "message": "Nazadnje je posodobil {byUser} {atDate}", + "description": "The sentence used to display when a page has been last updated, and by who" + }, + "theme.navbar.mobileVersionsDropdown.label": { + "message": "Versions", + "description": "The label for the navbar versions dropdown on mobile view" + }, + "theme.tags.tagsListLabel": { + "message": "Značke:", + "description": "The label alongside a tag list" + }, + "theme.AnnouncementBar.closeButtonAriaLabel": { + "message": "Zapri", + "description": "The ARIA label for close button of announcement bar" + }, + "theme.blog.sidebar.navAriaLabel": { + "message": "Blog recent posts navigation", + "description": "The ARIA label for recent posts in the blog sidebar" + }, + "theme.CodeBlock.copied": { + "message": "Kopirano", + "description": "The copied button label on code blocks" + }, + "theme.CodeBlock.copyButtonAriaLabel": { + "message": "Kopiraj kodo v odložišče", + "description": "The ARIA label for copy code blocks button" + }, + "theme.CodeBlock.copy": { + "message": "Kopiraj", + "description": "The copy button label on code blocks" + }, + "theme.CodeBlock.wordWrapToggle": { + "message": "Toggle word wrap", + "description": "The title attribute for toggle word wrapping button of code block lines" + }, + "theme.DocSidebarItem.toggleCollapsedCategoryAriaLabel": { + "message": "Toggle the collapsible sidebar category '{label}'", + "description": "The ARIA label to toggle the collapsible sidebar category" + }, + "theme.NavBar.navAriaLabel": { + "message": "Glavni", + "description": "The ARIA label for the main navigation" + }, + "theme.navbar.mobileLanguageDropdown.label": { + "message": "Jeziki", + "description": "The label for the mobile language switcher dropdown" + }, + "theme.TOCCollapsible.toggleButtonLabel": { + "message": "Na tej strani", + "description": "The label used by the button on the collapsible TOC component" + }, + "theme.blog.post.readMore": { + "message": "Preberi več", + "description": "The label used in blog post item excerpts to link to full blog posts" + }, + "theme.blog.post.readMoreLabel": { + "message": "Preberi več o {title}", + "description": "The ARIA label for the link to full blog posts from excerpts" + }, + "theme.blog.post.readingTime.plurals": { + "message": "Čas branja eno minuto|2 minuti branja|{readingTime} minut branja", + "description": "Pluralized label for \"{readingTime} min read\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.docs.breadcrumbs.home": { + "message": "Domača stran", + "description": "The ARIA label for the home page in the breadcrumbs" + }, + "theme.docs.sidebar.collapseButtonTitle": { + "message": "Zapri stranski meni", + "description": "The title attribute for collapse button of doc sidebar" + }, + "theme.docs.sidebar.collapseButtonAriaLabel": { + "message": "Zapri stranski meni", + "description": "The title attribute for collapse button of doc sidebar" + }, + "theme.docs.sidebar.navAriaLabel": { + "message": "Stranski meni", + "description": "The ARIA label for the sidebar navigation" + }, + "theme.docs.sidebar.closeSidebarButtonAriaLabel": { + "message": "Close navigation bar", + "description": "The ARIA label for close button of mobile sidebar" + }, + "theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel": { + "message": "← Nazaj na glavni meni", + "description": "The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)" + }, + "theme.docs.sidebar.toggleSidebarButtonAriaLabel": { + "message": "Toggle navigation bar", + "description": "The ARIA label for hamburger menu button of mobile navigation" + }, + "theme.docs.sidebar.expandButtonTitle": { + "message": "Expand sidebar", + "description": "The ARIA label and title attribute for expand button of doc sidebar" + }, + "theme.docs.sidebar.expandButtonAriaLabel": { + "message": "Expand sidebar", + "description": "The ARIA label and title attribute for expand button of doc sidebar" + }, + "theme.SearchPage.existingResultsTitle": { + "message": "Search results for \"{query}\"", + "description": "The search page title for non-empty query" + }, + "theme.SearchPage.emptyResultsTitle": { + "message": "Search the documentation", + "description": "The search page title for empty query" + }, + "theme.SearchPage.searchContext.everywhere": { + "message": "everywhere" + }, + "theme.SearchPage.documentsFound.plurals": { + "message": "1 dokument najden|2 dokumenta najdena|{count} dokumenti najdeni", + "description": "Pluralized label for \"{count} documents found\". Use as much plural forms (separated by \"|\") as your language support (see https://www.unicode.org/cldr/cldr-aux/charts/34/supplemental/language_plural_rules.html)" + }, + "theme.SearchPage.noResultsText": { + "message": "No documents were found", + "description": "The paragraph for empty search result" + }, + "theme.SearchBar.noResultsText": { + "message": "Ni rezultatov" + }, + "theme.SearchBar.seeAll": { + "message": "Poglej vse rezultate" + }, + "theme.SearchBar.seeAllOutsideContext": { + "message": "Poglej rezultate izven {context}" + }, + "theme.SearchBar.searchInContext": { + "message": "Poglej rezultate znotraj {context}" + }, + "theme.SearchBar.label": { + "message": "Iskanje", + "description": "The ARIA label and placeholder for search button" + }, + "theme.ErrorPageContent.tryAgain": { + "message": "Poskusi ponovno", + "description": "The label of the button to try again rendering when the React error boundary captures an error" + }, + "theme.common.skipToMainContent": { + "message": "Skip to main content", + "description": "The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation" + }, + "theme.tags.tagsPageTitle": { + "message": "Značke", + "description": "The title of the tag list page" + }, + "navbar.status.ok": { + "message": "Ok", + "description": "Text representing ok status" + }, + "navbar.status.issues": { + "message": "Tezave", + "description": "Text representing issues status" + }, + "navbar.status": { + "message": "Stanje", + "description": "Navbar item that links to status page" + }, + "home.signIn": { + "message": "Prijava" + }, + "home.requestAccess": { + "message": "Zaprosi za dostop" + }, + "home.descriptionTitle": { + "message": "Kaj je to?" + }, + "home.descriptionContent": { + "message": "We are non-profit provider of cloud services for select public. Our goal is to provide well integrated and coherent suite of applications that can rival offers of propriatery and for-profit companies. We use and build on top of open source software." + }, + "home.tagline": { + "message": "Tvoj osebni prostor v oblaku." + } +} diff --git a/i18n/sl/docusaurus-theme-classic/footer.json b/i18n/sl/docusaurus-theme-classic/footer.json new file mode 100644 index 0000000..7be6b54 --- /dev/null +++ b/i18n/sl/docusaurus-theme-classic/footer.json @@ -0,0 +1,26 @@ +{ + "link.title.Articles": { + "message": "Articles", + "description": "The title of the footer links column with title=Articles in the footer" + }, + "link.title.Community": { + "message": "Community", + "description": "The title of the footer links column with title=Community in the footer" + }, + "link.item.label.Documentation": { + "message": "Documentation", + "description": "The label of footer link with label=Documentation linking to /docs/home" + }, + "link.item.label.Blog": { + "message": "Blog", + "description": "The label of footer link with label=Blog linking to /blog" + }, + "link.item.label.Matrix Room #hello:tjo.space": { + "message": "Matrix Room #hello:tjo.space", + "description": "The label of footer link with label=Matrix Room #hello:tjo.space linking to https://matrix.to/#/#hello:tjo.space" + }, + "copyright": { + "message": "Copyright © 2023 tjo.space. Built with Docusaurus.", + "description": "The footer copyright" + } +} diff --git a/i18n/sl/docusaurus-theme-classic/navbar.json b/i18n/sl/docusaurus-theme-classic/navbar.json new file mode 100644 index 0000000..1ec6049 --- /dev/null +++ b/i18n/sl/docusaurus-theme-classic/navbar.json @@ -0,0 +1,14 @@ +{ + "logo.alt": { + "message": "tjo.space logo", + "description": "The alt text of navbar logo" + }, + "item.label.Documentation": { + "message": "Dokumentacija", + "description": "Navbar item with label Documentation" + }, + "item.label.Blog": { + "message": "Blog", + "description": "Navbar item with label Blog" + } +} diff --git a/src/components/NavbarItems/CustomStatusNavbarItem.tsx b/src/components/NavbarItems/CustomStatusNavbarItem.tsx index fb5c904..408f26f 100644 --- a/src/components/NavbarItems/CustomStatusNavbarItem.tsx +++ b/src/components/NavbarItems/CustomStatusNavbarItem.tsx @@ -1,13 +1,25 @@ -import clsx from "clsx"; +import Translate, { translate } from "@docusaurus/Translate"; import React, { useEffect, useState } from "react"; function Healthy({ healthy }) { - if (healthy) return Ok; + const statusOk = translate({ + id: "navbar.status.ok", + message: "Ok", + description: "Text representing ok status", + }); - return Issues; + const statusIssues = translate({ + id: "navbar.status.issues", + message: "Issues", + description: "Text representing issues status", + }); + + if (healthy) return {statusOk}; + + return {statusIssues}; } -function Mobile({ healthy }) { +function Mobile({ healthy, status }) { return (
  • - Status + {status} +
  • ); @@ -27,6 +40,12 @@ export default function CustomStatusNavbarItem(props: { }): JSX.Element | null { const [healthy, setHealthy] = useState(true); + const statusText = translate({ + id: "navbar.status", + message: "Status", + description: "Navbar item that links to status page", + }); + useEffect(() => { fetch( "https://api.github.com/repos/tjo-space/status/issues?status=open&label=status" @@ -35,11 +54,12 @@ export default function CustomStatusNavbarItem(props: { .then((issues) => setHealthy(issues.length === 0)); }, []); - if (props.mobile) return ; + if (props.mobile) + return ; return ( - Status + {statusText} ); } diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 6e5e0b2..eef67d9 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -6,40 +6,40 @@ import Layout from "@theme/Layout"; import HomepageFeatures from "@site/src/components/HomepageFeatures"; import styles from "./index.module.css"; +import Translate, { translate } from "@docusaurus/Translate"; function HomepageHeader() { - const { siteConfig } = useDocusaurusContext(); const Logo = require("@site/static/img/logo-light.svg").default; return (
    -

    {siteConfig.tagline}

    +

    + +

    - Sign In + - Request Access +
    -

    What is this?

    -

    We are non-profit provider of cloud services for select public.

    +

    + +

    - Our goal is to provide well integrated and coherent suite of - applications
    that can rival offers of propriatery and - for-profit companies. +

    -

    We use and build on top of open source software.

    You can read more about our{" "} @@ -62,8 +62,10 @@ function HomepageHeader() { export default function Home(): JSX.Element { const { siteConfig } = useDocusaurusContext(); + const title = translate({ id: "home.tagline" }); + const description = translate({ id: "home.descriptionContent" }); return ( - +