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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android-React Native] JSON files are not being loaded when phone has no connection #1602

Closed
cengizhanhakan opened this issue Jan 4, 2023 · 2 comments
Labels

Comments

@cengizhanhakan
Copy link

cengizhanhakan commented Jan 4, 2023

馃悰 Bug Report

JSON files are not being loaded when android phone has no connection. It works fine on iOS though. I have seen a similar issue but the author doesn't remember how he fixed it.

To Reproduce

A minimal reproducible example.
A codesandbox example or similar
or at least steps to reproduce the behavior:

  const i18nRef = useRef(createInstance());
  const [i18nReady, setI18nReady] = useState(false);

  const jsonMap = {
    en,
    de,
  };

  const initI18nInstance = async () => {
    const { languageTag } = deviceLanguage;

    const cachedTranslations = await getCachedTranslations(languageTag);

    i18nRef.current.init({
      lng: languageTag,
      cache: false,
      resources: {
        [languageTag]: {
          [DEFAULT_NAMESPACE]: cachedTranslations
            ? cachedTranslations.translations
            : jsonMap[languageTag],
        },
      },
    });

Expected behavior

It should load json files and I should be able to see translation values instead of keys

Your Environment

  • runtime version:node 16
  • i18next version: 22.4.6
  • "react-i18next version": "11.8.5"
  • os: Android
@jamuhl
Copy link
Member

jamuhl commented Jan 4, 2023

not sure what you expect...all tests run green, examples provided work. So this must actually be some issue in your code, which we really can't debug to check why it does not load - either your jsonMap does not work or you getCachedTranslations -> but both things are custom.

@stale
Copy link

stale bot commented Jan 16, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jan 16, 2023
@stale stale bot closed this as completed Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants