@docusaurus/theme-search-algolia 0.0.0-4210 → 0.0.0-4223

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.
package/lib/index.js CHANGED
@@ -12,6 +12,7 @@ const path_1 = (0, tslib_1.__importDefault)(require("path"));
12
12
  const fs_1 = (0, tslib_1.__importDefault)(require("fs"));
13
13
  const eta_1 = require("eta");
14
14
  const utils_1 = require("@docusaurus/utils");
15
+ const theme_translations_1 = require("@docusaurus/theme-translations");
15
16
  const opensearch_1 = (0, tslib_1.__importDefault)(require("./templates/opensearch"));
16
17
  const lodash_1 = require("lodash");
17
18
  const getCompiledOpenSearchTemplate = (0, lodash_1.memoize)(() => (0, eta_1.compile)(opensearch_1.default.trim()));
@@ -21,7 +22,7 @@ function renderOpenSearchTemplate(data) {
21
22
  }
22
23
  const OPEN_SEARCH_FILENAME = 'opensearch.xml';
23
24
  function theme(context) {
24
- const { baseUrl, siteConfig: { title, url, favicon }, } = context;
25
+ const { baseUrl, siteConfig: { title, url, favicon }, i18n: { currentLocale }, } = context;
25
26
  const pageComponent = './theme/SearchPage/index.js';
26
27
  const pagePath = (0, utils_1.getSwizzledComponent)(pageComponent) ||
27
28
  path_1.default.resolve(__dirname, pageComponent);
@@ -36,6 +37,12 @@ function theme(context) {
36
37
  getTypeScriptThemePath() {
37
38
  return path_1.default.resolve(__dirname, '..', 'src', 'theme');
38
39
  },
40
+ getDefaultCodeTranslationMessages() {
41
+ return (0, theme_translations_1.readDefaultCodeTranslationMessages)({
42
+ locale: currentLocale,
43
+ name: 'theme-search-algolia',
44
+ });
45
+ },
39
46
  async contentLoaded({ actions: { addRoute } }) {
40
47
  addRoute({
41
48
  path: (0, utils_1.normalizeUrl)([baseUrl, 'search']),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-search-algolia",
3
- "version": "0.0.0-4210",
3
+ "version": "0.0.0-4223",
4
4
  "description": "Algolia search component for Docusaurus.",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-search-algolia.d.ts",
@@ -21,10 +21,11 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@docsearch/react": "^3.0.0-alpha.39",
24
- "@docusaurus/core": "0.0.0-4210",
25
- "@docusaurus/theme-common": "0.0.0-4210",
26
- "@docusaurus/utils": "0.0.0-4210",
27
- "@docusaurus/utils-validation": "0.0.0-4210",
24
+ "@docusaurus/core": "0.0.0-4223",
25
+ "@docusaurus/theme-common": "0.0.0-4223",
26
+ "@docusaurus/theme-translations": "0.0.0-4223",
27
+ "@docusaurus/utils": "0.0.0-4223",
28
+ "@docusaurus/utils-validation": "0.0.0-4223",
28
29
  "algoliasearch": "^4.10.5",
29
30
  "algoliasearch-helper": "^3.5.5",
30
31
  "clsx": "^1.1.1",
@@ -32,7 +33,7 @@
32
33
  "lodash": "^4.17.20"
33
34
  },
34
35
  "devDependencies": {
35
- "@docusaurus/module-type-aliases": "0.0.0-4210",
36
+ "@docusaurus/module-type-aliases": "0.0.0-4223",
36
37
  "fs-extra": "^10.0.0"
37
38
  },
38
39
  "peerDependencies": {
@@ -42,5 +43,5 @@
42
43
  "engines": {
43
44
  "node": ">=14"
44
45
  },
45
- "gitHead": "f320249b6c689baca6e1142d03d5dec6d91b9099"
46
+ "gitHead": "dd2479b9f89bbe313b7e614f25725253b4011c5a"
46
47
  }
package/src/index.ts CHANGED
@@ -9,6 +9,7 @@ import path from 'path';
9
9
  import fs from 'fs';
10
10
  import {defaultConfig, compile} from 'eta';
11
11
  import {normalizeUrl, getSwizzledComponent} from '@docusaurus/utils';
12
+ import {readDefaultCodeTranslationMessages} from '@docusaurus/theme-translations';
12
13
  import openSearchTemplate from './templates/opensearch';
13
14
  import {memoize} from 'lodash';
14
15
 
@@ -35,6 +36,7 @@ export default function theme(
35
36
  const {
36
37
  baseUrl,
37
38
  siteConfig: {title, url, favicon},
39
+ i18n: {currentLocale},
38
40
  } = context;
39
41
  const pageComponent = './theme/SearchPage/index.js';
40
42
  const pagePath =
@@ -56,6 +58,13 @@ export default function theme(
56
58
  return path.resolve(__dirname, '..', 'src', 'theme');
57
59
  },
58
60
 
61
+ getDefaultCodeTranslationMessages() {
62
+ return readDefaultCodeTranslationMessages({
63
+ locale: currentLocale,
64
+ name: 'theme-search-algolia',
65
+ });
66
+ },
67
+
59
68
  async contentLoaded({actions: {addRoute}}) {
60
69
  addRoute({
61
70
  path: normalizeUrl([baseUrl, 'search']),