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

Fails completely with file:// URLs #100

Closed
tcobbs-bentley opened this issue Nov 1, 2022 · 1 comment
Closed

Fails completely with file:// URLs #100

tcobbs-bentley opened this issue Nov 1, 2022 · 1 comment

Comments

@tcobbs-bentley
Copy link

馃悰 Bug Report

This package is presented as a replacement for i18next-xhr-backend. Unfortunately, it omits support for one use case that worked fine with i18next-shr-backend: the use of file:// URLs for the localized resources in an environment that contains the fetch API. In that case, it tries to use the fetch API, and the fetch API simply states that file:// URLs are not supported, and so everything fails. The file:// URLs worked fine with i18next-xhr-backend.

To Reproduce

Set up a project that uses file:// URLs for its i18n json files. Make sure the fetch API is present at run-time.

I apologize for not providing better steps, but my project isn't something that I can share. I can say that it is an Android app that loads a React web app into a WebView using a file:// URL for the top-level URL for the web app, and hence all of the i18n json files also use file:// URLs.

My error messages in the Android debug console end up looking like this:

I/chromium: [INFO:CONSOLE(411487)] "Fetch API cannot load file:///android_asset/ITMApplication/frontend/locales/en-US/iModelJs.json. URL scheme "file" is not supported.", source: file:///android_asset/ITMApplication/frontend/static/js/0.e152a96b.chunk.js (411487)

Expected behavior

i18n should still work when using file:// URLs when loading json localization files.

Your Environment

  • runtime version: React 16.14.17 running in a WebView on Android
  • i18next version: 21.9.2
  • os: Android
@adrai adrai closed this as completed in 4670bef Nov 1, 2022
@adrai
Copy link
Member

adrai commented Nov 1, 2022

never used it that way...
v2.0.1 may work

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

2 participants