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

TypeError: Cannot read properties of undefined (reading 'on') #2

Open
Nowaker opened this issue May 26, 2022 · 4 comments
Open

TypeError: Cannot read properties of undefined (reading 'on') #2

Nowaker opened this issue May 26, 2022 · 4 comments

Comments

@Nowaker
Copy link

Nowaker commented May 26, 2022

🐛 Bug Report

% PUBLIC_DIR=_gatsby/public node ./_translate-pages-new.mjs
file:///home/nowaker/projekty/dreamhost/dreamhost-com/node_modules/locizify-ssg/dist/esm/index.js:26
    locizify.i18next.on('initialized', resolve);
                     ^

TypeError: Cannot read properties of undefined (reading 'on')
    at file:///home/nowaker/projekty/dreamhost/dreamhost-com/node_modules/locizify-ssg/dist/esm/index.js:26:22
    at new Promise (<anonymous>)
    at ssgLng (file:///home/nowaker/projekty/dreamhost/dreamhost-com/node_modules/locizify-ssg/dist/esm/index.js:25:16)
    at async file:///home/nowaker/projekty/dreamhost/dreamhost-com/_translate-pages-new.mjs:7:1

To Reproduce

# _translate-pages-new.mjs
import ssg from 'locizify-ssg'

const dir = process.env.PUBLIC_DIR || '_site/'

const file = `${dir}/es/index.html`

await ssg(file, 'es', file, {
  backend: {
    projectId: '3f516219-6546-4f2a-9030-fc31659dc115',
    apiKey: 'xxx',
    referenceLng: 'en'
  },
  fallbackLng: 'en',
  saveMissing: false,
  debug: false,
  namespace: 'root',
  ns: ['common'],
  translateAttributes: ['placeholder', 'title', 'alt', 'content#meta.name=description', 'content#meta.name=keywords', 'content#meta.property', 'value#input.type=submit', 'value#input.type=button', 'value#input.type=reset'],
  ignoreTags: ['script', 'style', 'iframe', 'svg'],
});

Expected behavior

No error.

Your Environment

  • runtime version: 16
  • module version: latest
  • os: Linux
@adrai
Copy link
Contributor

adrai commented May 27, 2022

How does your html look like?
how is locizify initialized (not locizify-ssg)?
is it lazy initialized?
a reproducible example repo including all relevant files etc... may help...

@Nowaker
Copy link
Author

Nowaker commented May 27, 2022

How does your html look like?

https://github.com/locize/locizify-ssg/files/8789656/index.tar.gz

how is locizify initialized (not locizify-ssg)?

Not initialized, not embedded, at all. I simply ran locizify-ssg against a static file that does not have any <script> to Locizify.

@adrai
Copy link
Contributor

adrai commented May 27, 2022

i think we can close this in favor of #1

@adrai
Copy link
Contributor

adrai commented May 27, 2022

v1.0.3 should be better

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