Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meta: updated all markdown files metadata and updated files to be ready for translation #6058

Merged
merged 14 commits into from
Oct 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
92 changes: 30 additions & 62 deletions components/Docs/NodeApiVersionLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,66 +1,34 @@
import { useMemo } from 'react';

import { useNodeReleases } from '@/hooks/useNodeReleases';
import { DOCS_URL } from '@/next.constants.mjs';

// Note.: This is a temporary Component used only until the transition to `nodejs/nodejs.dev` content is done
const NodeApiVersionLinks = () => (
<ul>
<li>
<a href={`${DOCS_URL}latest-v20.x/api/`}>Node.js 20.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v19.x/api/`}>Node.js 19.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v18.x/api/`}>Node.js 18.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v17.x/api/`}>Node.js 17.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v16.x/api/`}>Node.js 16.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v15.x/api/`}>Node.js 15.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v14.x/api/`}>Node.js 14.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v13.x/api/`}>Node.js 13.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v12.x/api/`}>Node.js 12.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v11.x/api/`}>Node.js 11.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v10.x/api/`}>Node.js 10.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v9.x/api/`}>Node.js 9.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v8.x/api/`}>Node.js 8.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v7.x/api/`}>Node.js 7.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v6.x/api/`}>Node.js 6.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v5.x/api/`}>Node.js 5.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v4.x/api/`}>Node.js 4.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v0.12.x/api/`}>Node.js 0.12.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v0.10.x/api/`}>Node.js 0.10.x</a>
</li>
</ul>
);
const NodeApiVersionLinks = () => {
const { releases } = useNodeReleases();

const mappedReleases = useMemo(
() =>
// Gets all major releases without the 0x release as those are divided on 0.12x and 0.10x
releases.slice(0, -1).map(({ major }) => (
<li key={major}>
<a href={`${DOCS_URL}latest-v${major}.x/api/`}>Node.js {major}.x</a>
</li>
)),
[releases]
);

return (
<ul>
{mappedReleases}

<li>
<a href={`${DOCS_URL}latest-v0.12.x/api/`}>Node.js 0.12.x</a>
</li>
<li>
<a href={`${DOCS_URL}latest-v0.10.x/api/`}>Node.js 0.10.x</a>
</li>
</ul>
);
};

export default NodeApiVersionLinks;
31 changes: 18 additions & 13 deletions components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import classNames from 'classnames';
import Image from 'next/image';
import { useTheme } from 'next-themes';
import { useState } from 'react';
import { useIntl } from 'react-intl';

import { useLocale } from '@/hooks/useLocale';
Expand All @@ -16,6 +17,8 @@ const Header = () => {
const { asPath, basePath } = useRouter();
const { theme, setTheme } = useTheme();

const [showLangPicker, setShowLangPicker] = useState(false);

const getLinkClassName = (href: string) =>
classNames({ active: isCurrentLocaleRoute(href, href !== '/') });

Expand Down Expand Up @@ -85,6 +88,7 @@ const Header = () => {
type="button"
title={toggleLanguage}
aria-label={toggleLanguage}
onClick={() => setShowLangPicker(!showLangPicker)}
aria-controls="lang-picker"
aria-expanded="false"
>
Expand All @@ -98,19 +102,20 @@ const Header = () => {
</button>
</div>

<ul id="lang-picker" className="lang-picker hidden">
{availableLocales.map(locale => (
<li key={locale.code}>
<a
data-lang={locale.code}
title={locale.name}
href={currentRouteLocalized(locale.code)}
>
{locale.localName}
</a>
</li>
))}
</ul>
{showLangPicker && (
<ul className="lang-picker">
{availableLocales.map(locale => (
<li key={locale.code}>
<a
title={locale.name}
href={currentRouteLocalized(locale.code)}
>
{locale.localName}
</a>
</li>
))}
</ul>
)}
</div>
</header>
);
Expand Down
35 changes: 21 additions & 14 deletions components/Home/HomeDownloadButton.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { FC } from 'react';
import { FormattedMessage, useIntl } from 'react-intl';

import LocalizedLink from '@/components/LocalizedLink';
import { useDetectOS } from '@/hooks/useDetectOS';
import { useLayoutContext } from '@/hooks/useLayoutContext';
import { DIST_URL } from '@/next.constants.mjs';
import type { NodeRelease } from '@/types';
import { downloadUrlByOS } from '@/util/downloadUrlByOS';
Expand All @@ -14,45 +14,52 @@ const HomeDownloadButton: FC<NodeRelease> = ({
versionWithPrefix,
isLts,
}) => {
const {
frontMatter: { labels },
} = useLayoutContext();

const { os, bitness } = useDetectOS();
const { formatMessage } = useIntl();

const nodeDownloadLink = downloadUrlByOS(versionWithPrefix, os, bitness);
const nodeApiLink = `${DIST_URL}latest-v${major}.x/docs/api/`;
const nodeAllDownloadsLink = `/download${isLts ? '/' : '/current'}`;

const nodeDownloadTitle = `${labels?.download} ${version} ${labels?.[
isLts ? 'lts' : 'current'
]}`;
const downloadFile = formatMessage(
{ id: 'components.home.homeDownloadButton.download' },
{ version, isLts }
);

return (
<div className="home-downloadblock">
<a
href={nodeDownloadLink}
className="home-downloadbutton"
title={nodeDownloadTitle}
title={downloadFile}
data-version={versionWithPrefix}
>
{version} {labels?.[isLts ? 'lts' : 'current']}
<small>{labels?.[`tagline-${isLts ? 'lts' : 'current'}`]}</small>
{downloadFile}

<FormattedMessage
id="components.home.homeDownloadButton.tagline"
tagName="small"
values={{ isLts }}
/>
</a>

<ul className="list-divider-pipe home-secondary-links">
<li>
<LocalizedLink href={nodeAllDownloadsLink}>
{labels?.['other-downloads']}
<FormattedMessage id="components.home.homeDownloadButton.otherDownloads" />
</LocalizedLink>
</li>

<li>
<a href={getNodejsChangelog(versionWithPrefix)}>
{labels?.changelog}
<FormattedMessage id="components.home.homeDownloadButton.changelog" />
</a>
</li>

<li>
<a href={nodeApiLink}>{labels?.api}</a>
<a href={nodeApiLink}>
<FormattedMessage id="components.home.homeDownloadButton.apiDocs" />
</a>
</li>
</ul>
</div>
Expand Down
6 changes: 3 additions & 3 deletions components/LocalizedLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ const LocalizedLink: FC<ComponentProps<typeof Link>> = ({
const { currentLocale } = useLocale();

const { Component, finalHref } = useMemo(() => {
if (/^https?:\/\//.test(href.toString())) {
return { Component: HtmlLink, finalHref: href.toString() };
if (!href || !href.toString().startsWith('/')) {
return { Component: HtmlLink, finalHref: href };
}

const addLocaleToHref = linkWithLocale(currentLocale.code);

return { Component: NextLink, finalHref: addLocaleToHref(href) };
// We only need to check if the toString() variant of URL has changed
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [currentLocale.code, href.toString()]);
}, [currentLocale.code, href]);

return (
<Component {...extra} href={finalHref}>
Expand Down
6 changes: 4 additions & 2 deletions crowdin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ files:
content_segmentation: 0
ignore:
- /pages/en/blog/**/*.md
- /pages/en/docs/**/*.md
- /pages/en/docs/guides/**/*.md
- /pages/en/download/index.md
- /pages/en/download/current.md
languages_mapping:
two_letters_code:
es-ES: es
Expand All @@ -20,7 +22,7 @@ files:
content_segmentation: 0
ignore:
- /pages/en/blog/**/*.mdx
- /pages/en/docs/**/*.mdx
- /pages/en/docs/guides/**/*.mdx
languages_mapping:
two_letters_code:
es-ES: es
Expand Down
15 changes: 12 additions & 3 deletions i18n/locales/ar.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"components.footer.scrollToTop.button": "Scroll to top",
"components.header.links.about": "About Node.js®",
"components.header.links.about": "About",
"components.header.links.download": "Download",
"components.header.links.docs": "Docs",
"components.header.links.getInvolved": "Get Involved",
Expand All @@ -13,7 +13,7 @@
"components.footer.links.security": "Security Policy",
"components.footer.links.openJS": "OpenJS Foundation",
"components.navigation.about.links.governance": "Project Governance",
"components.navigation.about.links.releases": "Releases",
"components.navigation.about.links.releases": "Previous Releases",
"components.navigation.about.links.security": "Security Reporting",
"components.navigation.docs.links.es6": "ES6 and beyond",
"components.navigation.docs.links.apiLts": "{fullLtsNodeVersion} API {spanLts}",
Expand All @@ -23,6 +23,7 @@
"components.navigation.getInvolved.links.collabSummit": "Collab Summit",
"components.navigation.getInvolved.links.contribute": "Contribute",
"components.navigation.getInvolved.links.codeOfConduct": "Code of Conduct",
"components.downloadList.links.previousReleases": "Previous Releases",
"components.downloadList.links.packageManager": "Installing Node.js via package manager",
"components.downloadList.links.shaSums": "Signed SHASUMS for release files",
"components.downloadList.links.shaSums.howToVerify": " (How to verify)",
Expand Down Expand Up @@ -64,5 +65,13 @@
"components.common.pagination.nextAriaLabel": "Next page",
"components.common.pagination.defaultLabel": "Pagination",
"components.common.pagination.pageLabel": "Go to page {pageNumber}",
"components.common.languageDropdown.label": "Choose Language"
"components.common.languageDropdown.label": "Choose Language",
"components.common.card.announcement": "Announcements",
"components.common.card.release": "Releases",
"components.common.card.vulnerability": "Vulnerabilities",
"components.home.homeDownloadButton.download": "Download {version} {isLts, select, true {lts} other {current}}",
"components.home.homeDownloadButton.tagline": "{isLts, select, true {Recommended For Most Users} other {Latest Features}}",
"components.home.homeDownloadButton.changelog": "Changelog",
"components.home.homeDownloadButton.otherDownloads": "Other Downloads",
"components.home.homeDownloadButton.apiDocs": "API Docs"
}
15 changes: 12 additions & 3 deletions i18n/locales/de.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"components.footer.scrollToTop.button": "Scroll to top",
"components.header.links.about": "About Node.js®",
"components.header.links.about": "About",
"components.header.links.download": "Download",
"components.header.links.docs": "Docs",
"components.header.links.getInvolved": "Get Involved",
Expand All @@ -13,7 +13,7 @@
"components.footer.links.security": "Security Policy",
"components.footer.links.openJS": "OpenJS Foundation",
"components.navigation.about.links.governance": "Project Governance",
"components.navigation.about.links.releases": "Releases",
"components.navigation.about.links.releases": "Previous Releases",
"components.navigation.about.links.security": "Security Reporting",
"components.navigation.docs.links.es6": "ES6 and beyond",
"components.navigation.docs.links.apiLts": "{fullLtsNodeVersion} API {spanLts}",
Expand All @@ -23,6 +23,7 @@
"components.navigation.getInvolved.links.collabSummit": "Collab Summit",
"components.navigation.getInvolved.links.contribute": "Contribute",
"components.navigation.getInvolved.links.codeOfConduct": "Code of Conduct",
"components.downloadList.links.previousReleases": "Previous Releases",
"components.downloadList.links.packageManager": "Installing Node.js via package manager",
"components.downloadList.links.shaSums": "Signed SHASUMS for release files",
"components.downloadList.links.shaSums.howToVerify": " (How to verify)",
Expand Down Expand Up @@ -64,5 +65,13 @@
"components.common.pagination.nextAriaLabel": "Next page",
"components.common.pagination.defaultLabel": "Pagination",
"components.common.pagination.pageLabel": "Go to page {pageNumber}",
"components.common.languageDropdown.label": "Choose Language"
"components.common.languageDropdown.label": "Choose Language",
"components.common.card.announcement": "Announcements",
"components.common.card.release": "Releases",
"components.common.card.vulnerability": "Vulnerabilities",
"components.home.homeDownloadButton.download": "Download {version} {isLts, select, true {lts} other {current}}",
"components.home.homeDownloadButton.tagline": "{isLts, select, true {Recommended For Most Users} other {Latest Features}}",
"components.home.homeDownloadButton.changelog": "Changelog",
"components.home.homeDownloadButton.otherDownloads": "Other Downloads",
"components.home.homeDownloadButton.apiDocs": "API Docs"
}
12 changes: 9 additions & 3 deletions i18n/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"components.footer.scrollToTop.button": "Scroll to top",
"components.header.links.about": "About Node.js®",
"components.header.links.about": "About",
"components.header.links.download": "Download",
"components.header.links.docs": "Docs",
"components.header.links.getInvolved": "Get Involved",
Expand All @@ -13,7 +13,7 @@
"components.footer.links.security": "Security Policy",
"components.footer.links.openJS": "OpenJS Foundation",
"components.navigation.about.links.governance": "Project Governance",
"components.navigation.about.links.releases": "Releases",
"components.navigation.about.links.releases": "Previous Releases",
"components.navigation.about.links.security": "Security Reporting",
"components.navigation.docs.links.es6": "ES6 and beyond",
"components.navigation.docs.links.apiLts": "{fullLtsNodeVersion} API {spanLts}",
Expand All @@ -23,6 +23,7 @@
"components.navigation.getInvolved.links.collabSummit": "Collab Summit",
"components.navigation.getInvolved.links.contribute": "Contribute",
"components.navigation.getInvolved.links.codeOfConduct": "Code of Conduct",
"components.downloadList.links.previousReleases": "Previous Releases",
"components.downloadList.links.packageManager": "Installing Node.js via package manager",
"components.downloadList.links.shaSums": "Signed SHASUMS for release files",
"components.downloadList.links.shaSums.howToVerify": " (How to verify)",
Expand Down Expand Up @@ -67,5 +68,10 @@
"components.common.languageDropdown.label": "Choose Language",
"components.common.card.announcement": "Announcements",
"components.common.card.release": "Releases",
"components.common.card.vulnerability": "Vulnerabilities"
"components.common.card.vulnerability": "Vulnerabilities",
"components.home.homeDownloadButton.download": "Download {version} {isLts, select, true {lts} other {current}}",
"components.home.homeDownloadButton.tagline": "{isLts, select, true {Recommended For Most Users} other {Latest Features}}",
"components.home.homeDownloadButton.changelog": "Changelog",
"components.home.homeDownloadButton.otherDownloads": "Other Downloads",
"components.home.homeDownloadButton.apiDocs": "API Docs"
}
Loading
Loading