diff --git a/.husky/.gitignore b/.husky/.gitignore new file mode 100644 index 000000000..31354ec13 --- /dev/null +++ b/.husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..15f34b6b0 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/sh +. "$(dirname "$0")/_/husky.sh" + +yarn update-l10n-sources diff --git a/i18n/en-US/code.json b/i18n/en-US/code.json new file mode 100644 index 000000000..8291b1051 --- /dev/null +++ b/i18n/en-US/code.json @@ -0,0 +1,202 @@ +{ + "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.AnnouncementBar.closeButtonAriaLabel": { + "message": "Close", + "description": "The ARIA label for close button of announcement bar" + }, + "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.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.tags.tagsListLabel": { + "message": "Tags:", + "description": "The label alongside a tag list" + }, + "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.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.sidebar.navAriaLabel": { + "message": "Blog recent posts navigation", + "description": "The ARIA label for recent posts in the blog sidebar" + }, + "theme.tags.tagsPageTitle": { + "message": "Tags", + "description": "The title of the tag list page" + }, + "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.CodeBlock.copyButtonAriaLabel": { + "message": "Copy code to clipboard", + "description": "The ARIA label for copy code blocks button" + }, + "theme.CodeBlock.copied": { + "message": "Copied", + "description": "The copied button label on code blocks" + }, + "theme.CodeBlock.copy": { + "message": "Copy", + "description": "The copy button label on code blocks" + }, + "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.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.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.responsiveCloseButtonLabel": { + "message": "Close menu", + "description": "The ARIA label for close button of mobile doc sidebar" + }, + "theme.docs.sidebar.responsiveOpenButtonLabel": { + "message": "Open menu", + "description": "The ARIA label for open button of mobile doc sidebar" + }, + "theme.docs.sidebar.navAriaLabel": { + "message": "Sidebar navigation", + "description": "The ARIA label for documentation menu" + }, + "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 userd to tell the user that he's browsing an unmaintained doc 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.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.SearchPage.documentsFound.plurals": { + "message": "One 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.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.inputPlaceholder": { + "message": "Type your search here", + "description": "The placeholder for search page input" + }, + "theme.SearchPage.inputLabel": { + "message": "Search", + "description": "The ARIA label for search page input" + }, + "theme.SearchPage.algoliaLabel": { + "message": "Search by Algolia", + "description": "The ARIA label for Algolia mention" + }, + "theme.SearchPage.noResultsText": { + "message": "No results were found", + "description": "The paragraph for empty search result" + }, + "theme.SearchPage.fetchingNewResults": { + "message": "Fetching new results...", + "description": "The paragraph for fetching new search results" + }, + "theme.SearchBar.label": { + "message": "Search", + "description": "The ARIA label and placeholder for search button" + } +} \ No newline at end of file diff --git a/i18n/en-US/docusaurus-plugin-content-docs/current.json b/i18n/en-US/docusaurus-plugin-content-docs/current.json new file mode 100644 index 000000000..b6f8224cb --- /dev/null +++ b/i18n/en-US/docusaurus-plugin-content-docs/current.json @@ -0,0 +1,70 @@ +{ + "version.label": { + "message": "Next", + "description": "The label for version current" + }, + "sidebar.docs.category.Get Started": { + "message": "Get Started", + "description": "The label for category Get Started in sidebar docs" + }, + "sidebar.docs.category.Development": { + "message": "Development", + "description": "The label for category Development in sidebar docs" + }, + "sidebar.docs.category.Performance": { + "message": "Performance", + "description": "The label for category Performance in sidebar docs" + }, + "sidebar.docs.category.Security": { + "message": "Security", + "description": "The label for category Security in sidebar docs" + }, + "sidebar.docs.category.Distribution": { + "message": "Distribution", + "description": "The label for category Distribution in sidebar docs" + }, + "sidebar.docs.category.Testing And Debugging": { + "message": "Testing And Debugging", + "description": "The label for category Testing And Debugging in sidebar docs" + }, + "sidebar.docs.category.How To": { + "message": "How To", + "description": "The label for category How To in sidebar docs" + }, + "sidebar.docs.category.Internals": { + "message": "Internals", + "description": "The label for category Internals in sidebar docs" + }, + "sidebar.docs.category.Resources": { + "message": "Resources", + "description": "The label for category Resources in sidebar docs" + }, + "sidebar.docs.category.Contributing": { + "message": "Contributing", + "description": "The label for category Contributing in sidebar docs" + }, + "sidebar.api.category.Main Process Modules": { + "message": "Main Process Modules", + "description": "The label for category Main Process Modules in sidebar api" + }, + "sidebar.api.category.Renderer Process Modules": { + "message": "Renderer Process Modules", + "description": "The label for category Renderer Process Modules in sidebar api" + }, + "sidebar.api.category.Custom DOM Elements": { + "message": "Custom DOM Elements", + "description": "The label for category Custom DOM Elements in sidebar api" + }, + "sidebar.api.category.Chromium and Node.js": { + "message": "Chromium and Node.js", + "description": "The label for category Chromium and Node.js in sidebar api" + }, + "sidebar.api.category.Classes": { + "message": "Classes", + "description": "The label for category Classes in sidebar api" + }, + "sidebar.api.category.API Structures": { + "message": "API Structures", + "description": "The label for category API Structures in sidebar api" + } +} \ No newline at end of file diff --git a/i18n/en-US/docusaurus-theme-classic/footer.json b/i18n/en-US/docusaurus-theme-classic/footer.json new file mode 100644 index 000000000..9956ea729 --- /dev/null +++ b/i18n/en-US/docusaurus-theme-classic/footer.json @@ -0,0 +1,46 @@ +{ + "link.title.Docs": { + "message": "Docs", + "description": "The title of the footer links column with title=Docs in the footer" + }, + "link.title.Community": { + "message": "Community", + "description": "The title of the footer links column with title=Community in the footer" + }, + "link.title.More": { + "message": "More", + "description": "The title of the footer links column with title=More in the footer" + }, + "link.item.label.Getting Started": { + "message": "Getting Started", + "description": "The label of footer link with label=Getting Started linking to /" + }, + "link.item.label.Performance": { + "message": "Performance", + "description": "The label of footer link with label=Performance linking to /performance/" + }, + "link.item.label.Security": { + "message": "Security", + "description": "The label of footer link with label=Security linking to /security/" + }, + "link.item.label.Stack Overflow": { + "message": "Stack Overflow", + "description": "The label of footer link with label=Stack Overflow linking to https://stackoverflow.com/questions/tagged/electron" + }, + "link.item.label.Discord": { + "message": "Discord", + "description": "The label of footer link with label=Discord linking to https://discordapp.com/invite/electron" + }, + "link.item.label.Twitter": { + "message": "Twitter", + "description": "The label of footer link with label=Twitter linking to https://twitter.com/electronjs" + }, + "link.item.label.GitHub": { + "message": "GitHub", + "description": "The label of footer link with label=GitHub linking to https://github.com/electron/electron" + }, + "copyright": { + "message": "Copyright © 2021 My Project, Inc. Built with Docusaurus.", + "description": "The footer copyright" + } +} \ No newline at end of file diff --git a/i18n/en-US/docusaurus-theme-classic/navbar.json b/i18n/en-US/docusaurus-theme-classic/navbar.json new file mode 100644 index 000000000..a8c240b20 --- /dev/null +++ b/i18n/en-US/docusaurus-theme-classic/navbar.json @@ -0,0 +1,22 @@ +{ + "title": { + "message": "Electron", + "description": "The title in the navbar" + }, + "item.label.Docs": { + "message": "Docs", + "description": "Navbar item with label Docs" + }, + "item.label.API": { + "message": "API", + "description": "Navbar item with label API" + }, + "item.label.Examples": { + "message": "Examples", + "description": "Navbar item with label Examples" + }, + "item.label.GitHub": { + "message": "GitHub", + "description": "Navbar item with label GitHub" + } +} \ No newline at end of file diff --git a/i18n/readme.md b/i18n/readme.md new file mode 100644 index 000000000..a87ac0585 --- /dev/null +++ b/i18n/readme.md @@ -0,0 +1,6 @@ +# About en-US + +The locale `en-US` is used to keep the translations up to date when +uploading the content to crowdin to avoid manually creating the +different JSON files and dealing with inconsistencies. +The contents are regenerated periodically. diff --git a/package.json b/package.json index 211dd4c27..2a0dc3598 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,13 @@ "serve": "docusaurus serve", "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", + "update-l10n-sources": "node scripts/update-l10n-sources.js", "lint": "prettier -c ./scripts/**/*.js", "test": "yarn lint && jest", "prebuild": "node ./scripts/pre-build.js", "process-docs-changes": "node ./scripts/process-docs-changes.js", - "update-pinned-version": "node ./scripts/update-pinned-version.js" + "update-pinned-version": "node ./scripts/update-pinned-version.js", + "prepare": "husky install" }, "dependencies": { "@docusaurus/core": "^2.0.0-beta.3", @@ -53,6 +55,7 @@ "globby": "^11.0.3", "got": "^11.8.2", "gunzip-maybe": "^1.4.2", + "husky": "^6.0.0", "jest": "^26.6.3", "json5": "^2.2.0", "latest-version": "^5.1.0", diff --git a/scripts/update-l10n-sources.js b/scripts/update-l10n-sources.js new file mode 100644 index 000000000..7f7f287a1 --- /dev/null +++ b/scripts/update-l10n-sources.js @@ -0,0 +1,33 @@ +//@ts-check + +/** + * This is a pre-hook task that checks if the files `docusaurus.config.js` or + * `sidebars.js` have been modified and if so makes sure that the files + * needed for localization are regenerated. + */ + +const { getChanges } = require('./utils/git-commands'); +const del = require('del'); +const { execute } = require('./utils/execute'); + +const files = ['docusaurus.config.js', 'sidebars.js']; + +const start = async () => { + console.log(`Checking if the following files have been modified: +${files.join('\n')}`); + const output = await getChanges(); + + const needsRegeneration = files.find((file) => { + return output.includes(`M ${file}`); + }); + + if (!needsRegeneration) { + console.log(`No changes found`); + return; + } + + await del('i18n/en-US'); + await execute('yarn write-translations --locale en-US'); +}; + +start(); diff --git a/yarn.lock b/yarn.lock index f451c1e57..cb1bd0a9e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5807,6 +5807,11 @@ human-signals@^2.1.0: resolved "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz" integrity sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw== +husky@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/husky/-/husky-6.0.0.tgz#810f11869adf51604c32ea577edbc377d7f9319e" + integrity sha512-SQS2gDTB7tBN486QSoKPKQItZw97BMOd+Kdb6ghfpBc0yXyzrddI0oDV5MkDAbuB4X2mO3/nj60TRMcYxwzZeQ== + iconv-lite@0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"