cmfcmf / docusaurus-search-local

Offline / Local Search for Docusaurus v2. Try it live at:
https://cmfcmf.github.io/OpenWeatherMap-PHP-API/
MIT License
451 stars 66 forks source link

Getting language tokens instead of translations #189

Open imp-dance opened 1 year ago

imp-dance commented 1 year ago

Please describe the bug you are seeing

After configuring the plugin like such:

    [
      require.resolve("@cmfcmf/docusaurus-search-local"),
      {
        language: "no",
      },
    ],

With my i18n set to

  i18n: {
    defaultLocale: "nb",
    locales: ["nb"],
  },

I'm not getting the "no" translations, but instead I'm getting the raw translation keys output in the DOM (ex: cmfcmf/d-s-l.searchBar.placeholder)

How can we best reproduce the bug?

By using the following configuration:

   plugins: [
    [
      require.resolve("@cmfcmf/docusaurus-search-local"),
      {
        language: "no",
      },
    ],
  ],
  i18n: {
    defaultLocale: "nb",
    locales: ["nb"],
  },

Which version of Docusaurus and @cmfcmf/docusaurus-search-local are you using?

xyz@0.0.0 /Users/abc/Documents/Projects/xyz
├─┬ @cmfcmf/docusaurus-search-local@1.1.0
│ └── @docusaurus/core@2.4.1 deduped
├── @docusaurus/core@2.4.1
├─┬ @docusaurus/plugin-content-docs@2.4.1
│ └── @docusaurus/core@2.4.1 deduped
├─┬ @docusaurus/preset-classic@2.4.1
│ ├── @docusaurus/core@2.4.1 deduped
│ ├─┬ @docusaurus/plugin-content-blog@2.4.1
│ │ └── @docusaurus/core@2.4.1 deduped
│ ├─┬ @docusaurus/plugin-content-pages@2.4.1
│ │ └── @docusaurus/core@2.4.1 deduped
│ ├─┬ @docusaurus/plugin-debug@2.4.1
│ │ └── @docusaurus/core@2.4.1 deduped
│ ├─┬ @docusaurus/plugin-google-analytics@2.4.1
│ │ └── @docusaurus/core@2.4.1 deduped
│ ├─┬ @docusaurus/plugin-google-gtag@2.4.1
│ │ └── @docusaurus/core@2.4.1 deduped
│ ├─┬ @docusaurus/plugin-google-tag-manager@2.4.1
│ │ └── @docusaurus/core@2.4.1 deduped
│ ├─┬ @docusaurus/plugin-sitemap@2.4.1
│ │ └── @docusaurus/core@2.4.1 deduped
│ ├─┬ @docusaurus/theme-classic@2.4.1
│ │ └── @docusaurus/core@2.4.1 deduped
│ └─┬ @docusaurus/theme-search-algolia@2.4.1
│   └── @docusaurus/core@2.4.1 deduped
├─┬ @docusaurus/theme-mermaid@2.4.1
│ └── @docusaurus/core@2.4.1 deduped
└─┬ docusaurus-plugin-sass@0.2.4
  └── @docusaurus/core@2.4.1 deduped

Which Node.js version are you using?

v18.1.0

Which theme are you using?

No, I am using a custom theme

How does your plugin config look like?

{
  language: "no",
}

Additional context

I actually also tried changing language to "en", and then doing another build+serve, but that gave me the same results. So I'm guessing my i18n is overriding the plugin config somehow?

FredrikMeyer commented 5 months ago

I get the same error today with the same config. My deps are these:

yarn list v1.22.22
├─ @cmfcmf/docusaurus-search-local@1.2.0
├─ @docusaurus/core@3.2.1
├─ @docusaurus/cssnano-preset@3.2.1
├─ @docusaurus/logger@3.2.1
├─ @docusaurus/mdx-loader@3.2.1
├─ @docusaurus/module-type-aliases@3.2.1
├─ @docusaurus/plugin-content-blog@3.2.1
├─ @docusaurus/plugin-content-docs@3.2.1
├─ @docusaurus/plugin-content-pages@3.2.1
├─ @docusaurus/plugin-debug@3.2.1
├─ @docusaurus/plugin-google-analytics@3.2.1
├─ @docusaurus/plugin-google-gtag@3.2.1
├─ @docusaurus/plugin-google-tag-manager@3.2.1
├─ @docusaurus/plugin-sitemap@3.2.1
├─ @docusaurus/preset-classic@3.2.1
├─ @docusaurus/react-loadable@5.5.2
├─ @docusaurus/theme-classic@3.2.1
├─ @docusaurus/theme-common@3.2.1
├─ @docusaurus/theme-mermaid@3.2.1
├─ @docusaurus/theme-search-algolia@3.2.1
├─ @docusaurus/theme-translations@3.2.1
├─ @docusaurus/types@3.2.1
├─ @docusaurus/utils-common@3.2.1
├─ @docusaurus/utils-validation@3.2.1
└─ @docusaurus/utils@3.2.1