Skip to content

Commit

Permalink
fix(grammar): LocalisedLink -> LocalizedLink (#5122)
Browse files Browse the repository at this point in the history
fix(grammar): LocalisedLink ->LocalizedLink

Co-authored-by: Claudio Wunder <cwunder@gnome.org>
  • Loading branch information
AugustinMauroy and ovflowd authored Mar 14, 2023
1 parent 5dfe793 commit 88c3081
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 35 deletions.
4 changes: 2 additions & 2 deletions components/Downloads/DownloadList.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FormattedMessage } from 'react-intl';

import LocalisedLink from '../LocalisedLink';
import LocalizedLink from '../LocalizedLink';
import { useNavigation } from '../../hooks/useNavigation';

import type { NodeVersionData } from '../../types';
Expand All @@ -20,7 +20,7 @@ const DownloadList = (props: DownloadListProps) => {
<ul>
{downloadNavigation.map((item, key) => (
<li key={key}>
<LocalisedLink href={item.link}>{item.text}</LocalisedLink>
<LocalizedLink href={item.link}>{item.text}</LocalizedLink>
{item.key === 'shaSums' && (
<a href="https://github.com/nodejs/node#verifying-binaries">
<FormattedMessage id="components.downloadList.links.shaSums.howToVerify" />
Expand Down
10 changes: 5 additions & 5 deletions components/Downloads/PrimaryDownloadMatrix.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames';

import LocalisedLink from '../LocalisedLink';
import LocalizedLink from '../LocalizedLink';
import { useNextraContext } from '../../hooks/useNextraContext';

import type { NodeVersionData, LegacyDownloadsFrontMatter } from '../../types';
Expand Down Expand Up @@ -31,24 +31,24 @@ const PrimaryDownloadMatrix = (props: PrimaryDownloadMatrixProps) => {
<div className="download-hero full-width">
<ul className="no-padding download-version-toggle">
<li>
<LocalisedLink
<LocalizedLink
className={getIsVersionClassName(props.isLts)}
href="/download/"
title={`${downloads['display-hint']} ${downloads.lts}`}
>
<div className="title">{downloads.lts}</div>
<div className="tag">{downloads['tagline-lts']}</div>
</LocalisedLink>
</LocalizedLink>
</li>
<li>
<LocalisedLink
<LocalizedLink
className={getIsVersionClassName(!props.isLts)}
href="/download/current/"
title={`${downloads['display-hint']} ${downloads.current}`}
>
<div className="title">{downloads.current}</div>
<div className="tag">{downloads['tagline-current']}</div>
</LocalisedLink>
</LocalizedLink>
</li>
</ul>
<ul className="no-padding download-platform">
Expand Down
8 changes: 4 additions & 4 deletions components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useIntl } from 'react-intl';
import Image from 'next/image';
import classNames from 'classnames';

import LocalisedLink from './LocalisedLink';
import LocalizedLink from './LocalizedLink';
import { useLocale } from '../hooks/useLocale';
import { useNavigation } from '../hooks/useNavigation';
import { useRouter } from 'next/router';
Expand Down Expand Up @@ -30,21 +30,21 @@ const Header = () => {
return (
<header aria-label="Primary">
<div className="container">
<LocalisedLink href="/" className="logo">
<LocalizedLink href="/" className="logo">
<Image
priority
width="111"
height="33"
src="/static/images/logo.svg"
alt="Node.js"
/>
</LocalisedLink>
</LocalizedLink>

<nav aria-label="primary">
<ul className="list-divider-pipe">
{navigationItems.map((item, key) => (
<li key={key} className={getLinkClassName(item.link)}>
<LocalisedLink href={item.link}>{item.text}</LocalisedLink>
<LocalizedLink href={item.link}>{item.text}</LocalizedLink>
</li>
))}
</ul>
Expand Down
12 changes: 6 additions & 6 deletions components/Home/HomeDownloadButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import LocalisedLink from '../LocalisedLink';
import LocalizedLink from '../LocalizedLink';
import { useNextraContext } from '../../hooks/useNextraContext';
import { getNodejsChangelog } from '../../util/getNodeJsChangelog';

Expand Down Expand Up @@ -35,17 +35,17 @@ const HomeDownloadButton = (props: HomeDownloadButtonProps) => {

<ul className="list-divider-pipe home-secondary-links">
<li>
<LocalisedLink href="/download/">
<LocalizedLink href="/download/">
{labels['other-downloads']}
</LocalisedLink>
</LocalizedLink>
</li>
<li>
<LocalisedLink href={getNodejsChangelog(props.node)}>
<LocalizedLink href={getNodejsChangelog(props.node)}>
{labels.changelog}
</LocalisedLink>
</LocalizedLink>
</li>
<li>
<LocalisedLink href={nodeApiLink}>{labels.api}</LocalisedLink>
<LocalizedLink href={nodeApiLink}>{labels.api}</LocalizedLink>
</li>
</ul>
</div>
Expand Down
10 changes: 5 additions & 5 deletions components/LocalisedLink.tsx → components/LocalizedLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import type { ComponentProps } from 'react';
import { useLocale } from '../hooks/useLocale';
import { linkWithLocale } from '../util/linkWithLocale';

const LocalisedLink = (props: ComponentProps<typeof Link>) => {
const LocalizedLink = (props: ComponentProps<typeof Link>) => {
const { href, children, ...extra } = props;

const { currentLocale } = useLocale();

const localisedUrl = linkWithLocale(currentLocale.code);
const localizedUrl = linkWithLocale(currentLocale.code);

const finalHref = useMemo(
() =>
/^https?:\/\//.test(href.toString())
? href.toString()
: localisedUrl(href),
[href, localisedUrl]
: localizedUrl(href),
[href, localizedUrl]
);

return (
Expand All @@ -27,4 +27,4 @@ const LocalisedLink = (props: ComponentProps<typeof Link>) => {
);
};

export default LocalisedLink;
export default LocalizedLink;
10 changes: 5 additions & 5 deletions components/Pagination.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { FormattedMessage } from 'react-intl';

import LocalisedLink from './LocalisedLink';
import LocalizedLink from './LocalizedLink';

type PaginationProps = { prevSlug?: string; nextSlug?: string };

const Pagination = (props: PaginationProps) => (
<nav aria-label="pagination" className="pagination">
{props.nextSlug && (
<LocalisedLink href={props.nextSlug}>
<LocalizedLink href={props.nextSlug}>
&lt; <FormattedMessage id="components.pagination.next" />
</LocalisedLink>
</LocalizedLink>
)}

{props.prevSlug && (
<LocalisedLink href={props.prevSlug}>
<LocalizedLink href={props.prevSlug}>
<FormattedMessage id="components.pagination.previous" /> &gt;
</LocalisedLink>
</LocalizedLink>
)}
</nav>
);
Expand Down
4 changes: 2 additions & 2 deletions components/SideNavigation.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from 'classnames';

import LocalisedLink from './LocalisedLink';
import LocalizedLink from './LocalizedLink';
import { useLocale } from '../hooks/useLocale';
import { useNavigation } from '../hooks/useNavigation';

Expand All @@ -25,7 +25,7 @@ const SideNavigation = ({ navigationKey, context }: SideNavigationProps) => {
<ul>
{sideNavigationItems.map((item, key) => (
<li key={key} className={getLinkClassName(item.link)}>
<LocalisedLink href={item.link}>{item.text}</LocalisedLink>
<LocalizedLink href={item.link}>{item.text}</LocalizedLink>
</li>
))}
</ul>
Expand Down
4 changes: 2 additions & 2 deletions hooks/useLocale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export const useLocale = () => {
const { currentLocale, availableLocales } = useContext(LocaleContext);
const { asPath } = useRouter();

const localisedLink = linkWithLocale(currentLocale!.code);
const LocalizedLink = linkWithLocale(currentLocale!.code);

const localisedPath = (route: string) =>
localisedLink(route).replace(/[#|?].*$/, '');
LocalizedLink(route).replace(/[#|?].*$/, '');

return {
availableLocales: availableLocales!,
Expand Down
4 changes: 2 additions & 2 deletions layouts/BlogIndexLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { PropsWithChildren } from 'react';

import BaseLayout from './BaseLayout';
import Pagination from '../components/Pagination';
import LocalisedLink from '../components/LocalisedLink';
import LocalizedLink from '../components/LocalizedLink';
import { useNextraContext } from '../hooks/useNextraContext';
import { getTimeComponent } from '../util/getTimeComponent';

Expand All @@ -25,7 +25,7 @@ const BlogIndexLayout = ({ children }: PropsWithChildren) => {
{blogData?.posts.map(post => (
<li key={post.slug}>
{getTimeComponent(post.date, '%d %b')}
<LocalisedLink href={post.slug}>{post.title}</LocalisedLink>
<LocalizedLink href={post.slug}>{post.title}</LocalizedLink>
</li>
))}
</ul>
Expand Down
4 changes: 2 additions & 2 deletions layouts/CategoryIndexLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { PropsWithChildren } from 'react';

import BaseLayout from './BaseLayout';
import LocalisedLink from '../components/LocalisedLink';
import LocalizedLink from '../components/LocalizedLink';
import { useNextraContext } from '../hooks/useNextraContext';
import { getTimeComponent } from '../util/getTimeComponent';

Expand All @@ -17,7 +17,7 @@ const CategoryIndexLayout = ({ children }: PropsWithChildren) => {
{blogData?.posts.map(post => (
<li key={post.slug}>
{getTimeComponent(post.date, '%d %b %y')}
<LocalisedLink href={post.slug}>{post.title}</LocalisedLink>
<LocalizedLink href={post.slug}>{post.title}</LocalizedLink>
</li>
))}
</ul>
Expand Down

0 comments on commit 88c3081

Please sign in to comment.