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

Error with custom contextBridgeApiKey #24

Open
danikaze opened this issue Aug 20, 2024 · 0 comments · May be fixed by #25
Open

Error with custom contextBridgeApiKey #24

danikaze opened this issue Aug 20, 2024 · 0 comments · May be fixed by #25

Comments

@danikaze
Copy link

I found that defining a custom contextBridgeApiKey in the options different to "api" (and placing the bindings there), this error is always triggered...

In my setup, I was abstracting the i18n setup placing it in window.__i18n instead of the default window.api...
If I set it on api, it works.

Based on my investigation, I found that i18next works creating an instance of the backend first with default options (no options), and then it calls instance.init() here with the proper options.

As the backend constructor calls this.init() here but the options haven't been set yet, it checks for the existence of window.api.i18nextElectronBackend by default... which is never going to exist because it should be defined in the custom key (window.__i18n.i18nextElectronBackend in my case).

Just commenting the call to this.init() fixes the problem... but I don't know if this call is needed for any compatibility issue with older versions of i18next...

danikaze added a commit to danikaze/i18next-electron-fs-backend that referenced this issue Aug 21, 2024
danikaze added a commit to danikaze/i18next-electron-fs-backend that referenced this issue Aug 21, 2024
@danikaze danikaze linked a pull request Aug 21, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant