diff --git a/.github/workflows/crowdin-download-workflow.yml b/.github/workflows/crowdin-download-workflow.yml index 088b17413..281f45399 100644 --- a/.github/workflows/crowdin-download-workflow.yml +++ b/.github/workflows/crowdin-download-workflow.yml @@ -8,8 +8,8 @@ on: description: "Branch to run this workflow on" required: true default: "main" - schedule: - - cron: "20 14,18,22 * * 1,2,3,4,5" # Runs at 20 minutes past beginning/middle/end of day Mon-Fri (UTC-6) (an hour after the upload action) + # schedule: + # - cron: "20 14,18,22 * * 1,2,3,4,5" # Runs at 20 minutes past beginning/middle/end of day Mon-Fri (UTC-6) (an hour after the upload action) permissions: contents: write diff --git a/.github/workflows/crowdin-upload-workflow.yml b/.github/workflows/crowdin-upload-workflow.yml index aca8029cb..017299609 100644 --- a/.github/workflows/crowdin-upload-workflow.yml +++ b/.github/workflows/crowdin-upload-workflow.yml @@ -3,8 +3,8 @@ name: Crowdin Upload Action on: workflow_call: workflow_dispatch: - schedule: - - cron: "20 13,17,21 * * 1,2,3,4,5" # Runs at 20 minutes past beginning/middle/end of day Mon-Fri (UTC-6) + # schedule: + # - cron: "20 13,17,21 * * 1,2,3,4,5" # Runs at 20 minutes past beginning/middle/end of day Mon-Fri (UTC-6) jobs: crowdin-upload: diff --git a/Dockerfile b/Dockerfile index 9c289c7b2..693278c15 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,12 +24,13 @@ RUN yarn stellar-cli:build --no-minify --cli-ref=main RUN yarn stellar-cli:fix-links ENV NODE_OPTIONS="--max-old-space-size=4096" -RUN if [ "$BUILD_TRANSLATIONS" = "True" ]; then \ - yarn docusaurus build --no-minify; \ - else \ - # In the preview build, we only want to build for English. Much quicker - yarn build --no-minify; \ - fi +# RUN if [ "$BUILD_TRANSLATIONS" = "True" ]; then \ +# yarn docusaurus build --no-minify; \ +# else \ +# # In the preview build, we only want to build for English. Much quicker +# yarn build --no-minify; \ +# fi +RUN yarn build --no-minify FROM nginx:1.29 diff --git a/config/constants.ts b/config/constants.ts index cbd6ca3ce..8cdc3ced1 100644 --- a/config/constants.ts +++ b/config/constants.ts @@ -38,3 +38,6 @@ export const CODE_LANGS = { typescript: 'TypeScript', yaml: 'YAML', }; + +const GOOGLE_TRANSLATE_LANGUAGES: string = "af,sq,am,en,fa,ar,ps,ja,zh-CN,hy,az,eu,be,bn,bs,bg,ca,ceb,ny,zh-TW,co,hr,cs,da,nl,eo,et,tl,fi,fr,fy,gl,ka,de,el,gu,ht,ha,haw,iw,hi,hmn,hu,is,ig,id,ga,it,jw,kn,kk,km,ko,ku,ky,lo,la,lv,lt,lb,mk,mg,ms,ml,mt,mi,mr,mn,my,ne,no,pl,pt,pa,ro,ru,sm,gd,sr,st,sn,sd,si,sk,sl,so,es,su,sw,sv,tg,ta,te,th,tr,uk,ur,uz,vi,cy,xh,yi,yo,zu"; +export const GOOGLE_TRANSLATE_ELEMENT: string = ``; diff --git a/config/theme/navbar.ts b/config/theme/navbar.ts index c01d23b7f..5daa0407a 100644 --- a/config/theme/navbar.ts +++ b/config/theme/navbar.ts @@ -1,4 +1,5 @@ -import type { NavbarItem } from '@docusaurus/theme-common' +import type { NavbarItem } from '@docusaurus/theme-common'; +import { GOOGLE_TRANSLATE_ELEMENT } from '../constants'; const build: NavbarItem = { type: 'dropdown', @@ -505,6 +506,23 @@ const validators: NavbarItem = { ] } +const translation: NavbarItem[] = [ + { + type: 'html', + position: 'right', + value: '
', + }, + { + type: 'html', + position: 'right', + value: GOOGLE_TRANSLATE_ELEMENT, + }, + // { + // type: 'localeDropdown', + // position: 'right', + // }, +] + export default { build, learn, @@ -513,4 +531,5 @@ export default { tools, networks, validators, + translation, } diff --git a/docusaurus.config.ts b/docusaurus.config.ts index a9ef1b65a..3f7570a17 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -2,7 +2,7 @@ import remarkMath from 'remark-math'; import rehypeKatex from 'rehype-katex'; import { themes as prismThemes } from 'prism-react-renderer'; -import { makeEditUrl, DEFAULT_LOCALE } from './config/constants'; +// import { makeEditUrl, DEFAULT_LOCALE, GOOGLE_TRANSLATE_ELEMENT } from './config/constants'; import navbarItems from './config/theme/navbar'; import footerColumns from './config/theme/footer'; import { headTags } from './config/theme/headTags'; @@ -27,10 +27,16 @@ const config: Config = { favicon: "img/docusaurus/favicon-96x96.png", organizationName: "stellar", projectName: "stellar-docs", - i18n: { - defaultLocale: DEFAULT_LOCALE, - locales: ["en", "es"], - }, + // i18n: { + // defaultLocale: DEFAULT_LOCALE, + // locales: ["en", "es"], + // }, + scripts: [ + { + src: 'https://translate.google.com/translate_a/element.js', + async: true, + }, + ], plugins: [ "docusaurus-plugin-sass", [ @@ -115,7 +121,8 @@ const config: Config = { rehypePlugins: [rehypeKatex], sidebarPath: "config/sidebars.ts", sidebarItemsGenerator: require("./src/sidebar-generator"), - editUrl: makeEditUrl, + // editUrl: makeEditUrl, + editUrl: "https://github.com/stellar/stellar-docs/edit/main", exclude: ['**/component/**', '**/CONTRIBUTING.md'], }, theme: { @@ -169,10 +176,7 @@ const config: Config = { navbarItems.tools, navbarItems.networks, navbarItems.validators, - { - type: 'localeDropdown', - position: 'right', - }, + ...navbarItems.translation, { href: "https://github.com/stellar/stellar-docs", position: "right", diff --git a/package.json b/package.json index d32017e60..48494536a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "docusaurus": "docusaurus", "start": "docusaurus start", - "build": "docusaurus build --locale en", + "build": "docusaurus build", "swizzle": "docusaurus swizzle", "deploy": "docusaurus deploy", "clear": "docusaurus clear", diff --git a/src/css/custom.scss b/src/css/custom.scss index 25ce964d8..87ce93bec 100644 --- a/src/css/custom.scss +++ b/src/css/custom.scss @@ -66,12 +66,10 @@ html[data-theme="dark"] { --ifm-background-color: var(--ifm-color-black); } -.markdown > h4 { +.markdown>h4 { --ifm-h4-font-size: 1.25rem; - margin-bottom: calc( - var(--ifm-heading-vertical-rhythm-bottom) * var(--ifm-leading) - ); + margin-bottom: calc(var(--ifm-heading-vertical-rhythm-bottom) * var(--ifm-leading)); margin-top: calc(var(--ifm-h4-vertical-rhythm-top) * var(--ifm-leading)); } @@ -93,8 +91,7 @@ html[data-theme="dark"] { svg { height: 1.5rem; width: 1.5rem; - transition: color var(--ifm-transition-fast) - var(--ifm-transition-timing-default); + transition: color var(--ifm-transition-fast) var(--ifm-transition-timing-default); &:hover, &:focus { @@ -126,20 +123,14 @@ html[data-theme="dark"] { div[class^="announcementBar_"] { font-size: 18px; - --site-announcement-bar-stripe-color1: hsl( - var(--site-primary-hue-saturation) 85% - ); - --site-announcement-bar-stripe-color2: hsl( - var(--site-primary-hue-saturation) 95% - ); - - background: repeating-linear-gradient( - 35deg, - var(--site-announcement-bar-stripe-color1), - var(--site-announcement-bar-stripe-color1) 20px, - var(--site-announcement-bar-stripe-color2) 10px, - var(--site-announcement-bar-stripe-color2) 40px - ); + --site-announcement-bar-stripe-color1: hsl(var(--site-primary-hue-saturation) 85%); + --site-announcement-bar-stripe-color2: hsl(var(--site-primary-hue-saturation) 95%); + + background: repeating-linear-gradient(35deg, + var(--site-announcement-bar-stripe-color1), + var(--site-announcement-bar-stripe-color1) 20px, + var(--site-announcement-bar-stripe-color2) 10px, + var(--site-announcement-bar-stripe-color2) 40px); height: fit-content; } @@ -162,7 +153,7 @@ div[class^="announcementBar_"] { } } -.navbar .dropdown > a.active { +.navbar .dropdown>a.active { color: var(--ifm-color-primary); } @@ -202,6 +193,21 @@ select[data-testid="example-pairing-select"] { var(--ifm-transition-timing-default); } +.goog-te-gadget .goog-te-combo { + margin: 0 !important; +} + +.my-google-translate-button::before { + content: ''; + width: 24px; + height: 24px; + display: flex; + background-color: var(--ifm-navbar-link-color); + mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' aria-hidden='true' style='vertical-align: text-bottom' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z'%3E%3C/path%3E%3C/svg%3E"); + transition: background-color var(--ifm-transition-fast) + var(--ifm-transition-timing-default); +} + /* Hubble data dictionary formatting */ .scoped-data-dictionary-table table { display: table; @@ -209,15 +215,15 @@ select[data-testid="example-pairing-select"] { max-width: 135%; thead { - color: var(--ifm-color-primary-darker); - background-color: var(--ifm-color-gray-300); - font-size: large; - text-align: left; - text-wrap: nowrap; + color: var(--ifm-color-primary-darker); + background-color: var(--ifm-color-gray-300); + font-size: large; + text-align: left; + text-wrap: nowrap; } td { - font-size: small; + font-size: small; } } @@ -230,7 +236,7 @@ select[data-testid="example-pairing-select"] { .dropdown__link.has-nested-items::after { content: '➜'; - margin-left: 10px; // spacing (use margin instead of padding when using flex) + margin-left: 10px; // spacing (use margin instead of padding when using flex) font-size: 1em; line-height: 1; display: inline-block;