Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to load locales or server is down #469

Open
mr-scrpt opened this issue Jul 26, 2023 · 1 comment
Open

Failed to load locales or server is down #469

mr-scrpt opened this issue Jul 26, 2023 · 1 comment

Comments

@mr-scrpt
Copy link

Hi, I have updated the project packages to the latest versions and after that loki stopped working
When i run yarn loki test i get the error
1 request failed to load; http://192.168.1.106:6006/locales/en-US/translation.json
But I don't have that path in my project and I don't understand where it gets it from, here is the actual path for translations (not en-US, just en)
http://localhost:6006/locales/en/translation.json
The dev server of the storybook is working correctly
So I also tried running a check on the static build of the storybook
yarn loki --requireReference --reactUri file:./storybook-static
I'm getting an error

Failed fetching stories because the server is down
       Try starting it with "yarn storybook" or pass the --port or --host arguments if it's not running at http://192.168.1.106:30528

But this command doesn't need a storybook server at all, because I'm checking static files in the folder

@mr-scrpt
Copy link
Author

The wrong i18n config file was connected for the storybook - when I connected the right one, the first problem disappeared. Then I made some edits to the i18n config and it solved the second problem, here is how my config looks like

import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'

import Backend from 'i18next-http-backend'
import LanguageDetector from 'i18next-browser-languagedetector'

i18n
  .use(Backend)
  .use(LanguageDetector)
  .use(initReactI18next)
  .init({
    // lng: 'en',
    fallbackLng: 'en',
    // debug: __IS_DEV__,
    debug: true,
    load: 'languageOnly',

    interpolation: {
      escapeValue: false, // not needed for react as it escapes by default
    },
    backend: {
      loadPath: '/locales/{{lng}}/{{ns}}.json',
    },
    keySeparator: false,
  })

export default i18n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant