@docusaurus/theme-classic 0.0.0-4492 → 0.0.0-4501

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -138,7 +138,17 @@ function BlogPostItem(props) {
138
138
  })}>
139
139
  <Link
140
140
  to={metadata.permalink}
141
- aria-label={`Read more about ${title}`}>
141
+ aria-label={translate(
142
+ {
143
+ message: 'Read more about {title}',
144
+ id: 'theme.blog.post.readMoreLabel',
145
+ description:
146
+ 'The ARIA label for the link to full blog posts from excerpts',
147
+ },
148
+ {
149
+ title,
150
+ },
151
+ )}>
142
152
  <b>
143
153
  <Translate
144
154
  id="theme.blog.post.readMore"
@@ -10,6 +10,7 @@ import {findFirstCategoryLink, useDocById} from '@docusaurus/theme-common';
10
10
  import clsx from 'clsx';
11
11
  import styles from './styles.module.css';
12
12
  import isInternalUrl from '@docusaurus/isInternalUrl';
13
+ import {translate} from '@docusaurus/Translate';
13
14
 
14
15
  function CardContainer({href, children}) {
15
16
  const className = clsx(
@@ -48,7 +49,17 @@ function CardCategory({item}) {
48
49
  href={href}
49
50
  icon="🗃️"
50
51
  title={item.label}
51
- description={`${item.items.length} items`}
52
+ description={translate(
53
+ {
54
+ message: '{count} items',
55
+ id: 'theme.docs.DocCard.categoryDescription',
56
+ description:
57
+ 'The default description for a category card in the generated index about how many items this category includes',
58
+ },
59
+ {
60
+ count: item.items.length,
61
+ },
62
+ )}
52
63
  />
53
64
  );
54
65
  }
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
+ import Translate from '@docusaurus/Translate';
8
9
  import {ThemeClassNames, useDocsVersion} from '@docusaurus/theme-common';
9
10
  import clsx from 'clsx';
10
11
  export default function DocVersionBadge({className}) {
@@ -18,7 +19,13 @@ export default function DocVersionBadge({className}) {
18
19
  ThemeClassNames.docs.docVersionBadge,
19
20
  'badge badge--secondary',
20
21
  )}>
21
- Version: {versionMetadata.label}
22
+ <Translate
23
+ id="theme.docs.versionBadge.label"
24
+ values={{
25
+ versionLabel: versionMetadata.label,
26
+ }}>
27
+ {'Version: {versionLabel}'}
28
+ </Translate>
22
29
  </span>
23
30
  );
24
31
  }
@@ -9,6 +9,7 @@ import DropdownNavbarItem from '@theme/NavbarItem/DropdownNavbarItem';
9
9
  import IconLanguage from '@theme/IconLanguage';
10
10
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
11
11
  import {useAlternatePageUtils} from '@docusaurus/theme-common';
12
+ import {translate} from '@docusaurus/Translate';
12
13
  import styles from './styles.module.css';
13
14
  export default function LocaleDropdownNavbarItem({
14
15
  mobile,
@@ -41,7 +42,13 @@ export default function LocaleDropdownNavbarItem({
41
42
  });
42
43
  const items = [...dropdownItemsBefore, ...localeItems, ...dropdownItemsAfter]; // Mobile is handled a bit differently
43
44
 
44
- const dropdownLabel = mobile ? 'Languages' : getLocaleLabel(currentLocale);
45
+ const dropdownLabel = mobile
46
+ ? translate({
47
+ message: 'Languages',
48
+ id: 'theme.navbar.mobileLanguageDropdown.label',
49
+ description: 'The label for the mobile language switcher dropdown',
50
+ })
51
+ : getLocaleLabel(currentLocale);
45
52
  return (
46
53
  <DropdownNavbarItem
47
54
  {...props}
@@ -7,6 +7,7 @@
7
7
  import React, {useState, useRef, memo} from 'react';
8
8
  import {useThemeConfig} from '@docusaurus/theme-common';
9
9
  import useIsBrowser from '@docusaurus/useIsBrowser';
10
+ import {translate} from '@docusaurus/Translate';
10
11
  import clsx from 'clsx';
11
12
  import styles from './styles.module.css'; // Based on react-toggle (https://github.com/aaronshaf/react-toggle/).
12
13
 
@@ -47,7 +48,11 @@ const ToggleComponent = memo(
47
48
  checked={checked}
48
49
  type="checkbox"
49
50
  className={styles.toggleScreenReader}
50
- aria-label="Switch between dark and light mode"
51
+ aria-label={translate({
52
+ message: 'Switch between dark and light mode',
53
+ id: 'theme.colorToggle.ariaLabel',
54
+ description: 'The ARIA label for the navbar color mode toggle',
55
+ })}
51
56
  onChange={onChange}
52
57
  onClick={() => setChecked(!checked)}
53
58
  onFocus={() => setFocused(true)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4492",
3
+ "version": "0.0.0-4501",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -21,15 +21,15 @@
21
21
  "format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
22
22
  },
23
23
  "dependencies": {
24
- "@docusaurus/core": "0.0.0-4492",
25
- "@docusaurus/plugin-content-blog": "0.0.0-4492",
26
- "@docusaurus/plugin-content-docs": "0.0.0-4492",
27
- "@docusaurus/plugin-content-pages": "0.0.0-4492",
28
- "@docusaurus/theme-common": "0.0.0-4492",
29
- "@docusaurus/theme-translations": "0.0.0-4492",
30
- "@docusaurus/utils": "0.0.0-4492",
31
- "@docusaurus/utils-common": "0.0.0-4492",
32
- "@docusaurus/utils-validation": "0.0.0-4492",
24
+ "@docusaurus/core": "0.0.0-4501",
25
+ "@docusaurus/plugin-content-blog": "0.0.0-4501",
26
+ "@docusaurus/plugin-content-docs": "0.0.0-4501",
27
+ "@docusaurus/plugin-content-pages": "0.0.0-4501",
28
+ "@docusaurus/theme-common": "0.0.0-4501",
29
+ "@docusaurus/theme-translations": "0.0.0-4501",
30
+ "@docusaurus/utils": "0.0.0-4501",
31
+ "@docusaurus/utils-common": "0.0.0-4501",
32
+ "@docusaurus/utils-validation": "0.0.0-4501",
33
33
  "@mdx-js/react": "^1.6.21",
34
34
  "clsx": "^1.1.1",
35
35
  "copy-text-to-clipboard": "^3.0.1",
@@ -42,8 +42,8 @@
42
42
  "rtlcss": "^3.3.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@docusaurus/module-type-aliases": "0.0.0-4492",
46
- "@docusaurus/types": "0.0.0-4492",
45
+ "@docusaurus/module-type-aliases": "0.0.0-4501",
46
+ "@docusaurus/types": "0.0.0-4501",
47
47
  "@types/mdx-js__react": "^1.5.4",
48
48
  "@types/parse-numeric-range": "^0.0.1",
49
49
  "@types/prismjs": "^1.16.2",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=14"
62
62
  },
63
- "gitHead": "415285c8972b89d17923fe23bed2eedab3daa393"
63
+ "gitHead": "53867e522d42d77e0668fe9ccda6fa674978f010"
64
64
  }
@@ -135,7 +135,15 @@ function BlogPostItem(props: Props): JSX.Element {
135
135
  })}>
136
136
  <Link
137
137
  to={metadata.permalink}
138
- aria-label={`Read more about ${title}`}>
138
+ aria-label={translate(
139
+ {
140
+ message: 'Read more about {title}',
141
+ id: 'theme.blog.post.readMoreLabel',
142
+ description:
143
+ 'The ARIA label for the link to full blog posts from excerpts',
144
+ },
145
+ {title},
146
+ )}>
139
147
  <b>
140
148
  <Translate
141
149
  id="theme.blog.post.readMore"
@@ -16,6 +16,7 @@ import {findFirstCategoryLink, useDocById} from '@docusaurus/theme-common';
16
16
  import clsx from 'clsx';
17
17
  import styles from './styles.module.css';
18
18
  import isInternalUrl from '@docusaurus/isInternalUrl';
19
+ import {translate} from '@docusaurus/Translate';
19
20
 
20
21
  function CardContainer({
21
22
  href,
@@ -70,7 +71,15 @@ function CardCategory({item}: {item: PropSidebarItemCategory}): JSX.Element {
70
71
  href={href}
71
72
  icon="🗃️"
72
73
  title={item.label}
73
- description={`${item.items.length} items`}
74
+ description={translate(
75
+ {
76
+ message: '{count} items',
77
+ id: 'theme.docs.DocCard.categoryDescription',
78
+ description:
79
+ 'The default description for a category card in the generated index about how many items this category includes',
80
+ },
81
+ {count: item.items.length},
82
+ )}
74
83
  />
75
84
  );
76
85
  }
@@ -6,6 +6,7 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
+ import Translate from '@docusaurus/Translate';
9
10
  import {ThemeClassNames, useDocsVersion} from '@docusaurus/theme-common';
10
11
  import clsx from 'clsx';
11
12
  import type {Props} from '@theme/DocVersionBadge';
@@ -22,7 +23,11 @@ export default function DocVersionBadge({
22
23
  ThemeClassNames.docs.docVersionBadge,
23
24
  'badge badge--secondary',
24
25
  )}>
25
- Version: {versionMetadata.label}
26
+ <Translate
27
+ id="theme.docs.versionBadge.label"
28
+ values={{versionLabel: versionMetadata.label}}>
29
+ {'Version: {versionLabel}'}
30
+ </Translate>
26
31
  </span>
27
32
  );
28
33
  }
@@ -11,6 +11,7 @@ import IconLanguage from '@theme/IconLanguage';
11
11
  import type {Props} from '@theme/NavbarItem/LocaleDropdownNavbarItem';
12
12
  import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
13
13
  import {useAlternatePageUtils} from '@docusaurus/theme-common';
14
+ import {translate} from '@docusaurus/Translate';
14
15
  import type {LinkLikeNavbarItemProps} from '@theme/NavbarItem';
15
16
 
16
17
  import styles from './styles.module.css';
@@ -48,7 +49,13 @@ export default function LocaleDropdownNavbarItem({
48
49
  const items = [...dropdownItemsBefore, ...localeItems, ...dropdownItemsAfter];
49
50
 
50
51
  // Mobile is handled a bit differently
51
- const dropdownLabel = mobile ? 'Languages' : getLocaleLabel(currentLocale);
52
+ const dropdownLabel = mobile
53
+ ? translate({
54
+ message: 'Languages',
55
+ id: 'theme.navbar.mobileLanguageDropdown.label',
56
+ description: 'The label for the mobile language switcher dropdown',
57
+ })
58
+ : getLocaleLabel(currentLocale);
52
59
 
53
60
  return (
54
61
  <DropdownNavbarItem
@@ -9,6 +9,7 @@ import React, {useState, useRef, memo} from 'react';
9
9
  import type {Props} from '@theme/Toggle';
10
10
  import {useThemeConfig, type ColorModeConfig} from '@docusaurus/theme-common';
11
11
  import useIsBrowser from '@docusaurus/useIsBrowser';
12
+ import {translate} from '@docusaurus/Translate';
12
13
 
13
14
  import clsx from 'clsx';
14
15
  import styles from './styles.module.css';
@@ -61,7 +62,11 @@ const ToggleComponent = memo(
61
62
  checked={checked}
62
63
  type="checkbox"
63
64
  className={styles.toggleScreenReader}
64
- aria-label="Switch between dark and light mode"
65
+ aria-label={translate({
66
+ message: 'Switch between dark and light mode',
67
+ id: 'theme.colorToggle.ariaLabel',
68
+ description: 'The ARIA label for the navbar color mode toggle',
69
+ })}
65
70
  onChange={onChange}
66
71
  onClick={() => setChecked(!checked)}
67
72
  onFocus={() => setFocused(true)}