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.

translation.json 404 error

See original GitHub issue

🐛 Bug Report

i18next-http backend, trying to get ns “translation” even though the default name is “common”. And I get 404 error on console. My code working well but I don’t want get console error.

My code:

import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import backend from "i18next-http-backend";
import languageDetector from "i18next-browser-languagedetector";

i18n
  .use(initReactI18next) // passes i18n down to react-i18next
  .use(backend) // for /public/locales
  .use(languageDetector)
  .init({
    fallbackLng: "en",
    supportedLngs: ["en", "tr"],

    defaultNS: "common",

    keySeparator: false, // we do not use keys in form messages.welcome

    interpolation: {
      escapeValue: false, // react already safes from xss
    },
  });

export default i18n;

My console log

request.js:60 GET https://tweet-maker-react.netlify.app/locales/en/translation.json 404

My public folder

public – locales ---- en ------ common.json ---- tr ------ common.json

Environment

  • Node.js v12
  • i18next version: 19.9.1
  • Netlify

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
adraicommented, Mar 6, 2021

The ns options also defaults to [‘translation’]: https://www.i18next.com/overview/configuration-options image

So you need to change that too: image

0reactions
adraicommented, Mar 6, 2021

If you like this module don’t forget to star this repo. Make a tweet, share the word or have a look at our https://locize.com to support the devs of this project.

There are many ways to help this project 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

Magento 2: js-translation.json 404 (Not Found) on production ...
I used this command : bin/magento setup:static-content:deploy --theme=Vendor/Theme en_US -f. This command created js-translation.json .
Read more >
js-translation.json 404 - Magento Forums
Hello, I run MC v2.2 and when I try to add a product I get the spinning wheel & I have this error...
Read more >
Magento 2: js-translation.json 404 (Not Found) on production ...
After switching to the production mode, an error appeared in the console : pub/static/adminhtml/Magento/backend/en_US/js-translation.json 404 (Not Found) ...
Read more >
Getting 404 error for translation.json even if defaultNs ... - GitHub
Error comes out when trying to switch locale. Here is plunker: http://plnkr.co/edit/NVHURr Here is config for plugin.
Read more >
Magento 2: js-translation.json 404 (Not Found) on production ...
Magento: Magento 2: js- translation. json 404 (Not Found ) on production modeHelpful? Please support me on Patreon: ...
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