From 481c53fec019c30d2453f60350827e28601475fb Mon Sep 17 00:00:00 2001 From: sanjam chhatwal Date: Thu, 18 May 2023 15:40:40 +0400 Subject: [PATCH 01/11] feat: translation set up --- docusaurus.config.js | 14 +++++++++++++- i18n-config.js | 14 ++++++++++++++ package-lock.json | 16 ++++++++-------- 3 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 i18n-config.js diff --git a/docusaurus.config.js b/docusaurus.config.js index 5186b780..de82ccbe 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -24,7 +24,15 @@ const config = { // to replace "en" with "zh-Hans". i18n: { defaultLocale: 'en', - locales: ['en'], + locales: ['en', 'pr'], + localeConfigs: { + en: { + label: 'English', + }, + pr: { + label: 'Portuguese', + }, + }, }, plugins: ['@docusaurus/theme-live-codeblock', 'docusaurus-plugin-sass'], @@ -82,6 +90,10 @@ const config = { type: 'custom-user-navbar-item', position: 'right', }, + { + type: 'localeDropdown', + position: 'right', + }, ], }, prism: { diff --git a/i18n-config.js b/i18n-config.js new file mode 100644 index 00000000..85644e9e --- /dev/null +++ b/i18n-config.js @@ -0,0 +1,14 @@ +export const en = { + // language for the root path e.g. for www.deriv.com + is_default: true, + path: 'en', + display_name: 'English', + short_name: 'EN', + affiliate_lang: 0, +}; +export const pt = { + path: 'pt', + display_name: 'Português', + short_name: 'PT', + affiliate_lang: 9, +}; diff --git a/package-lock.json b/package-lock.json index e1c58396..d2e48f6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1966,11 +1966,11 @@ } }, "node_modules/@babel/runtime": { - "version": "7.20.1", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.1.tgz", - "integrity": "sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.5.tgz", + "integrity": "sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q==", "dependencies": { - "regenerator-runtime": "^0.13.10" + "regenerator-runtime": "^0.13.11" }, "engines": { "node": ">=6.9.0" @@ -26389,11 +26389,11 @@ } }, "@babel/runtime": { - "version": "7.20.1", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.1.tgz", - "integrity": "sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==", + "version": "7.21.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.21.5.tgz", + "integrity": "sha512-8jI69toZqqcsnqGGqwGS4Qb1VwLOEp4hz+CXPywcvjs60u3B4Pom/U/7rm4W8tMOYEB+E9wgD0mW1l3r8qlI9Q==", "requires": { - "regenerator-runtime": "^0.13.10" + "regenerator-runtime": "^0.13.11" } }, "@babel/runtime-corejs3": { From cd90492226f2c0e7fe4e4373358305c5544cfe3f Mon Sep 17 00:00:00 2001 From: sanjam chhatwal Date: Thu, 18 May 2023 16:33:53 +0400 Subject: [PATCH 02/11] fix: empty commitx --- i18n-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n-config.js b/i18n-config.js index 85644e9e..a5d993e5 100644 --- a/i18n-config.js +++ b/i18n-config.js @@ -10,5 +10,5 @@ export const pt = { path: 'pt', display_name: 'Português', short_name: 'PT', - affiliate_lang: 9, + affiliate_lang: 9, //empty commit }; From 5dbed58b4f324c9959070047a6405cf1eb5dc49c Mon Sep 17 00:00:00 2001 From: sanjam chhatwal Date: Wed, 31 May 2023 16:47:44 +0400 Subject: [PATCH 03/11] chore: translation setup --- i18n/pr/code.json | 284 ++++++++++++++++++ .../current.json | 50 +++ i18n/pr/docusaurus-theme-classic/navbar.json | 22 ++ 3 files changed, 356 insertions(+) create mode 100644 i18n/pr/code.json create mode 100644 i18n/pr/docusaurus-plugin-content-docs/current.json create mode 100644 i18n/pr/docusaurus-theme-classic/navbar.json diff --git a/i18n/pr/code.json b/i18n/pr/code.json new file mode 100644 index 00000000..69cfbd8c --- /dev/null +++ b/i18n/pr/code.json @@ -0,0 +1,284 @@ +{ + "Change API endpoint": { + "message": "Change API endpoint" + }, + "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.ErrorPageContent.title": { + "message": "This page crashed.", + "description": "The title of the fallback page when the page crashed" + }, + "theme.NotFound.title": { + "message": "Page Not Found", + "description": "The title of the 404 page" + }, + "theme.NotFound.p1": { + "message": "We could not find what you were looking for.", + "description": "The first paragraph of the 404 page" + }, + "theme.NotFound.p2": { + "message": "Please contact the owner of the site that linked you to the original URL and let them know their link is broken.", + "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.BackToTopButton.buttonAriaLabel": { + "message": "Scroll back to top", + "description": "The ARIA label for the back to top button" + }, + "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.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.paginator.navAriaLabel": { + "message": "Docs pages navigation", + "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": "Edit this page", + "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": " on {date}", + "description": "The words used to describe on which date a page has been last updated" + }, + "theme.lastUpdated.byUser": { + "message": " by {user}", + "description": "The words used to describe by who the page has been last updated" + }, + "theme.lastUpdated.lastUpdatedAtBy": { + "message": "Last updated{atDate}{byUser}", + "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": "Tags:", + "description": "The label alongside a tag list" + }, + "theme.AnnouncementBar.closeButtonAriaLabel": { + "message": "Close", + "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": "Copied", + "description": "The copied button label on code blocks" + }, + "theme.CodeBlock.copyButtonAriaLabel": { + "message": "Copy code to clipboard", + "description": "The ARIA label for copy code blocks button" + }, + "theme.CodeBlock.copy": { + "message": "Copy", + "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": "Main", + "description": "The ARIA label for the main navigation" + }, + "theme.navbar.mobileLanguageDropdown.label": { + "message": "Languages", + "description": "The label for the mobile language switcher dropdown" + }, + "theme.TOCCollapsible.toggleButtonLabel": { + "message": "On this page", + "description": "The label used by the button on the collapsible TOC component" + }, + "theme.blog.post.readMore": { + "message": "Read More", + "description": "The label used in blog post item excerpts to link to full blog posts" + }, + "theme.blog.post.readMoreLabel": { + "message": "Read more about {title}", + "description": "The ARIA label for the link to full blog posts from excerpts" + }, + "theme.blog.post.readingTime.plurals": { + "message": "One min read|{readingTime} min read", + "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": "Home page", + "description": "The ARIA label for the home page in the breadcrumbs" + }, + "theme.docs.sidebar.collapseButtonTitle": { + "message": "Collapse sidebar", + "description": "The title attribute for collapse button of doc sidebar" + }, + "theme.docs.sidebar.collapseButtonAriaLabel": { + "message": "Collapse sidebar", + "description": "The title attribute for collapse button of doc sidebar" + }, + "theme.docs.sidebar.navAriaLabel": { + "message": "Docs sidebar", + "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": "← Back to main menu", + "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.Playground.result": { + "message": "Result", + "description": "The result label of the live codeblocks" + }, + "theme.Playground.liveEditor": { + "message": "Live Editor", + "description": "The live editor label of the live codeblocks" + }, + "theme.ErrorPageContent.tryAgain": { + "message": "Try again", + "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": "Tags", + "description": "The title of the tag list page" + } +} diff --git a/i18n/pr/docusaurus-plugin-content-docs/current.json b/i18n/pr/docusaurus-plugin-content-docs/current.json new file mode 100644 index 00000000..c6f7c00c --- /dev/null +++ b/i18n/pr/docusaurus-plugin-content-docs/current.json @@ -0,0 +1,50 @@ +{ + "version.label": { + "message": "Next", + "description": "The label for version current" + }, + "sidebar.tutorialSidebar.category.Core Concepts": { + "message": "Core Concepts", + "description": "The label for category Core Concepts in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Core Concepts.link.generated-index.description": { + "message": "Learn core concepts of Deriv API websocket server and it's features", + "description": "The generated-index page description for category Core Concepts in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Code Examples": { + "message": "Code Examples", + "description": "The label for category Code Examples in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Code Examples.link.generated-index.description": { + "message": "Learn more about the API with our code examples", + "description": "The generated-index page description for category Code Examples in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Javascript Examples": { + "message": "Javascript Examples", + "description": "The label for category Javascript Examples in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Javascript Examples.link.generated-index.description": { + "message": "Javascript code examples", + "description": "The generated-index page description for category Javascript Examples in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Languages": { + "message": "Languages", + "description": "The label for category Languages in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Languages.link.generated-index.description": { + "message": "Learn how to use Deriv websocket API features with your Language of your choice", + "description": "The generated-index page description for category Languages in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Javascript": { + "message": "Javascript", + "description": "The label for category Javascript in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Javascript.link.generated-index.description": { + "message": "Learn how to use Deriv Websocket APIs with Javascript and HTML & CSS", + "description": "The generated-index page description for category Javascript in sidebar tutorialSidebar" + }, + "sidebar.tutorialSidebar.category.Guides": { + "message": "Guides", + "description": "The label for category Guides in sidebar tutorialSidebar" + } +} diff --git a/i18n/pr/docusaurus-theme-classic/navbar.json b/i18n/pr/docusaurus-theme-classic/navbar.json new file mode 100644 index 00000000..8c688c00 --- /dev/null +++ b/i18n/pr/docusaurus-theme-classic/navbar.json @@ -0,0 +1,22 @@ +{ + "logo.alt": { + "message": "Deriv API logo", + "description": "The alt text of navbar logo" + }, + "item.label.Documentation": { + "message": "Documentation", + "description": "Navbar item with label Documentation" + }, + "item.label.Dashboard": { + "message": "Dashboard", + "description": "Navbar item with label Dashboard" + }, + "item.label.API Explorer": { + "message": "API Explorer", + "description": "Navbar item with label API Explorer" + }, + "item.label.Blog": { + "message": "Blog", + "description": "Navbar item with label Blog" + } +} From 6b591cb9f267343621eb1f2cc5c1c05b4b73344e Mon Sep 17 00:00:00 2001 From: sanjam chhatwal Date: Wed, 31 May 2023 16:49:28 +0400 Subject: [PATCH 04/11] chore: translation setup --- i18n-config.js | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 i18n-config.js diff --git a/i18n-config.js b/i18n-config.js deleted file mode 100644 index a5d993e5..00000000 --- a/i18n-config.js +++ /dev/null @@ -1,14 +0,0 @@ -export const en = { - // language for the root path e.g. for www.deriv.com - is_default: true, - path: 'en', - display_name: 'English', - short_name: 'EN', - affiliate_lang: 0, -}; -export const pt = { - path: 'pt', - display_name: 'Português', - short_name: 'PT', - affiliate_lang: 9, //empty commit -}; From 4d2234af947470e59e7f89907c3f6b6cf82b673e Mon Sep 17 00:00:00 2001 From: sanjam chhatwal Date: Thu, 1 Jun 2023 18:34:49 +0400 Subject: [PATCH 05/11] chore: translate added to text --- src/features/Apiexplorer/RequestJSONBox/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/features/Apiexplorer/RequestJSONBox/index.tsx b/src/features/Apiexplorer/RequestJSONBox/index.tsx index 12b52411..e0c89f0d 100644 --- a/src/features/Apiexplorer/RequestJSONBox/index.tsx +++ b/src/features/Apiexplorer/RequestJSONBox/index.tsx @@ -5,6 +5,7 @@ import RequestResponseRenderer from '../RequestResponseRenderer'; import style from './RequestJSONBox.module.scss'; import SubscribeRenderer from '../SubscribeRenderer'; import { TSocketSubscribableEndpointNames } from '@site/src/configs/websocket/types'; +import Translate from '@docusaurus/Translate'; interface TRequestJSONBox { handleChange: React.ChangeEventHandler; @@ -27,7 +28,7 @@ function RequestJSONBox({