question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Where to place translation files in Docs theme? Getting "Cannot find module"

See original GitHub issue

I’ve been trying to set up a Nuxt Content site using the Docs theme. I need to translate strings to Dutch, so I’ve set up the following in the config file:

i18n: {
    locales: () => [{
      code: 'nl',
      iso: 'nl-BE',
      file: 'nl-BE.json',
      name: 'Nederlands'
    }],
    defaultLocale: 'nl',
  },

Looking at the generated .nuxt folder, it appears the folder it needs to go into is i18n/, but when the server starts it complains about it not finding the module ./nl-BE.json. I’ve tried pasting it around to pretty much everywhere with many different folder names I found around the web, but none worked. I’ve also tried doing it the javascript way and calling it nl-BE.js and exporting the object, but it still can’t find the module.

I have also added the langDir option manually to no avail.

Is there something I’m not getting about this system (first time working with i18n localization) or is there something else wrong?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Raguracommented, Jan 29, 2021

Hello @benjamincanac, thank you for pointing me in the right direction! I opened a PR to add the file, though it’s the first time I’ve ever contributed a PR to an open source project. In other words, I hope I did it right and followed the guidelines correctly.

Thanks for taking the time to help!

0reactions
benjamincanaccommented, Jan 29, 2021

Hey @Ragura, unfortunately this translation file does not exist yet in the docs-theme, check out the available locales: https://github.com/nuxt/content/tree/dev/packages/theme-docs/src/i18n. Feel free to open a PR to add it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

tsc throws `TS2307: Cannot find module` for a local file
In some cases you just need to update the include array. { "compilerOptions" ...
Read more >
How to fix "The following module is missing from the file ...
Restore the module and actually disable and uninstall it (recommended if possible): First, restore the module to its original location in the file...
Read more >
Cannot find module 'X' Error in TypeScript | bobbyhadz
The "Cannot find module or its corresponding type declarations" error occurs when TypeScript cannot locate a third-party or local module in our project....
Read more >
Translation | Django documentation
In practice you'll use this to get a string you can use in multiple places in a template or so you can use...
Read more >
cannot find module 'react-router-dom' or its corresponding ...
I am unable to load any of the Docusaurus modules during testing. Another user had the same issue and his fix does allow...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found