ikhudo / gatsby-i18n-plugin

MIT License
40 stars 13 forks source link

backendConnector error in production build in starter #2

Open itfarrier opened 6 years ago

itfarrier commented 6 years ago

Build works with warnings.

/home/user/.nvm/versions/node/v10.13.0/bin/node /home/user/.nvm/versions/node/v10.13.0/lib/node_modules/yarn/bin/yarn.js run serve
yarn run v1.12.3
$ yarn build && gatsby serve
$ gatsby build
success open and validate gatsby-configs — 0.006 s
success load plugins — 0.111 s
success onPreInit — 0.099 s
success delete html and css files from previous builds — 0.018 s
info One or more of your plugins have changed since the last time you ran Gatsby. As
a precaution, we're deleting your site's cache to ensure there's not any stale
data
success initialize cache — 0.006 s
success copy gatsby files — 0.008 s
success @igorko: copy redirect component — 0.000 s
success onPreBootstrap — 0.004 s
@@@ will run
@@@ will run
success @igorko: create node: de_messages — 0.016 s
success @igorko: create node: en_messages — 0.002 s
success source and transform nodes — 0.047 s
success building schema — 0.124 s
success createPages — 0.006 s
success createPagesStatefully — 0.027 s
success onPreExtractQueries — 0.001 s
success update schema — 0.074 s
success extract queries from components — 0.032 s
success run graphql queries — 0.043 s — 15/15 355.66 queries/second
success write out page data — 0.002 s
success write out redirect data — 0.000 s
done generating icons for manifest
success onPostBootstrap — 0.101 s

info bootstrap finished - 1.655 s

success Building production JavaScript and CSS bundles — 1.914 s
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next: languageChanged en
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next: languageChanged de
i18next: languageChanged en
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next: languageChanged de
i18next: languageChanged en
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next: languageChanged de
i18next: languageChanged en
i18next: languageChanged de
i18next: initialized { debug: true,
  initImmediate: true,
  ns: [ 'translation', 'messages' ],
  defaultNS: 'messages',
  fallbackLng: [ 'en' ],
  fallbackNS: false,
  whitelist: false,
  nonExplicitWhitelist: false,
  load: 'all',
  preload: false,
  simplifyPluralSuffix: true,
  keySeparator: '.',
  nsSeparator: ':',
  pluralSeparator: '_',
  contextSeparator: '_',
  saveMissing: false,
  updateMissing: false,
  saveMissingTo: 'fallback',
  saveMissingPlurals: true,
  missingKeyHandler: false,
  missingInterpolationHandler: false,
  postProcess: false,
  returnNull: true,
  returnEmptyString: true,
  returnObjects: false,
  joinArrays: false,
  returnedObjectHandler: [Function: returnedObjectHandler],
  parseMissingKeyHandler: false,
  appendNamespaceToMissingKey: false,
  appendNamespaceToCIMode: false,
  overloadTranslationOptionHandler: [Function: handle],
  interpolation:
   { escapeValue: true,
     format: [Function: format],
     prefix: '{{',
     suffix: '}}',
     formatSeparator: ',',
     unescapePrefix: '-',
     nestingPrefix: '$t(',
     nestingSuffix: ')',
     maxReplaces: 1000 } }
i18next: initialized { debug: true,
  initImmediate: true,
  ns: [ 'translation', 'messages' ],
  defaultNS: 'messages',
  fallbackLng: [ 'en' ],
  fallbackNS: false,
  whitelist: false,
  nonExplicitWhitelist: false,
  load: 'all',
  preload: false,
  simplifyPluralSuffix: true,
  keySeparator: '.',
  nsSeparator: ':',
  pluralSeparator: '_',
  contextSeparator: '_',
  saveMissing: false,
  updateMissing: false,
  saveMissingTo: 'fallback',
  saveMissingPlurals: true,
  missingKeyHandler: false,
  missingInterpolationHandler: false,
  postProcess: false,
  returnNull: true,
  returnEmptyString: true,
  returnObjects: false,
  joinArrays: false,
  returnedObjectHandler: [Function: returnedObjectHandler],
  parseMissingKeyHandler: false,
  appendNamespaceToMissingKey: false,
  appendNamespaceToCIMode: false,
  overloadTranslationOptionHandler: [Function: handle],
  interpolation:
   { escapeValue: true,
     format: [Function: format],
     prefix: '{{',
     suffix: '}}',
     formatSeparator: ',',
     unescapePrefix: '-',
     nestingPrefix: '$t(',
     nestingSuffix: ')',
     maxReplaces: 1000 } }
i18next: initialized { debug: true,
  initImmediate: true,
  ns: [ 'translation', 'messages' ],
  defaultNS: 'messages',
  fallbackLng: [ 'en' ],
  fallbackNS: false,
  whitelist: false,
  nonExplicitWhitelist: false,
  load: 'all',
  preload: false,
  simplifyPluralSuffix: true,
  keySeparator: '.',
  nsSeparator: ':',
  pluralSeparator: '_',
  contextSeparator: '_',
  saveMissing: false,
  updateMissing: false,
  saveMissingTo: 'fallback',
  saveMissingPlurals: true,
  missingKeyHandler: false,
  missingInterpolationHandler: false,
  postProcess: false,
  returnNull: true,
  returnEmptyString: true,
  returnObjects: false,
  joinArrays: false,
  returnedObjectHandler: [Function: returnedObjectHandler],
  parseMissingKeyHandler: false,
  appendNamespaceToMissingKey: false,
  appendNamespaceToCIMode: false,
  overloadTranslationOptionHandler: [Function: handle],
  interpolation:
   { escapeValue: true,
     format: [Function: format],
     prefix: '{{',
     suffix: '}}',
     formatSeparator: ',',
     unescapePrefix: '-',
     nestingPrefix: '$t(',
     nestingSuffix: ')',
     maxReplaces: 1000 } }
i18next: initialized { debug: true,
  initImmediate: true,
  ns: [ 'translation', 'messages' ],
  defaultNS: 'messages',
  fallbackLng: [ 'en' ],
  fallbackNS: false,
  whitelist: false,
  nonExplicitWhitelist: false,
  load: 'all',
  preload: false,
  simplifyPluralSuffix: true,
  keySeparator: '.',
  nsSeparator: ':',
  pluralSeparator: '_',
  contextSeparator: '_',
  saveMissing: false,
  updateMissing: false,
  saveMissingTo: 'fallback',
  saveMissingPlurals: true,
  missingKeyHandler: false,
  missingInterpolationHandler: false,
  postProcess: false,
  returnNull: true,
  returnEmptyString: true,
  returnObjects: false,
  joinArrays: false,
  returnedObjectHandler: [Function: returnedObjectHandler],
  parseMissingKeyHandler: false,
  appendNamespaceToMissingKey: false,
  appendNamespaceToCIMode: false,
  overloadTranslationOptionHandler: [Function: handle],
  interpolation:
   { escapeValue: true,
     format: [Function: format],
     prefix: '{{',
     suffix: '}}',
     formatSeparator: ',',
     unescapePrefix: '-',
     nestingPrefix: '$t(',
     nestingSuffix: ')',
     maxReplaces: 1000 } }
i18next: initialized { debug: true,
  initImmediate: true,
  ns: [ 'translation', 'messages' ],
  defaultNS: 'messages',
  fallbackLng: [ 'en' ],
  fallbackNS: false,
  whitelist: false,
  nonExplicitWhitelist: false,
  load: 'all',
  preload: false,
  simplifyPluralSuffix: true,
  keySeparator: '.',
  nsSeparator: ':',
  pluralSeparator: '_',
  contextSeparator: '_',
  saveMissing: false,
  updateMissing: false,
  saveMissingTo: 'fallback',
  saveMissingPlurals: true,
  missingKeyHandler: false,
  missingInterpolationHandler: false,
  postProcess: false,
  returnNull: true,
  returnEmptyString: true,
  returnObjects: false,
  joinArrays: false,
  returnedObjectHandler: [Function: returnedObjectHandler],
  parseMissingKeyHandler: false,
  appendNamespaceToMissingKey: false,
  appendNamespaceToCIMode: false,
  overloadTranslationOptionHandler: [Function: handle],
  interpolation:
   { escapeValue: true,
     format: [Function: format],
     prefix: '{{',
     suffix: '}}',
     formatSeparator: ',',
     unescapePrefix: '-',
     nestingPrefix: '$t(',
     nestingSuffix: ')',
     maxReplaces: 1000 } }
i18next: initialized { debug: true,
  initImmediate: true,
  ns: [ 'translation', 'messages' ],
  defaultNS: 'messages',
  fallbackLng: [ 'en' ],
  fallbackNS: false,
  whitelist: false,
  nonExplicitWhitelist: false,
  load: 'all',
  preload: false,
  simplifyPluralSuffix: true,
  keySeparator: '.',
  nsSeparator: ':',
  pluralSeparator: '_',
  contextSeparator: '_',
  saveMissing: false,
  updateMissing: false,
  saveMissingTo: 'fallback',
  saveMissingPlurals: true,
  missingKeyHandler: false,
  missingInterpolationHandler: false,
  postProcess: false,
  returnNull: true,
  returnEmptyString: true,
  returnObjects: false,
  joinArrays: false,
  returnedObjectHandler: [Function: returnedObjectHandler],
  parseMissingKeyHandler: false,
  appendNamespaceToMissingKey: false,
  appendNamespaceToCIMode: false,
  overloadTranslationOptionHandler: [Function: handle],
  interpolation:
   { escapeValue: true,
     format: [Function: format],
     prefix: '{{',
     suffix: '}}',
     formatSeparator: ',',
     unescapePrefix: '-',
     nestingPrefix: '$t(',
     nestingSuffix: ')',
     maxReplaces: 1000 } }
i18next: initialized { debug: true,
  initImmediate: true,
  ns: [ 'translation', 'messages' ],
  defaultNS: 'messages',
  fallbackLng: [ 'en' ],
  fallbackNS: false,
  whitelist: false,
  nonExplicitWhitelist: false,
  load: 'all',
  preload: false,
  simplifyPluralSuffix: true,
  keySeparator: '.',
  nsSeparator: ':',
  pluralSeparator: '_',
  contextSeparator: '_',
  saveMissing: false,
  updateMissing: false,
  saveMissingTo: 'fallback',
  saveMissingPlurals: true,
  missingKeyHandler: false,
  missingInterpolationHandler: false,
  postProcess: false,
  returnNull: true,
  returnEmptyString: true,
  returnObjects: false,
  joinArrays: false,
  returnedObjectHandler: [Function: returnedObjectHandler],
  parseMissingKeyHandler: false,
  appendNamespaceToMissingKey: false,
  appendNamespaceToCIMode: false,
  overloadTranslationOptionHandler: [Function: handle],
  interpolation:
   { escapeValue: true,
     format: [Function: format],
     prefix: '{{',
     suffix: '}}',
     formatSeparator: ',',
     unescapePrefix: '-',
     nestingPrefix: '$t(',
     nestingSuffix: ')',
     maxReplaces: 1000 } }
i18next: initialized { debug: true,
  initImmediate: true,
  ns: [ 'translation', 'messages' ],
  defaultNS: 'messages',
  fallbackLng: [ 'en' ],
  fallbackNS: false,
  whitelist: false,
  nonExplicitWhitelist: false,
  load: 'all',
  preload: false,
  simplifyPluralSuffix: true,
  keySeparator: '.',
  nsSeparator: ':',
  pluralSeparator: '_',
  contextSeparator: '_',
  saveMissing: false,
  updateMissing: false,
  saveMissingTo: 'fallback',
  saveMissingPlurals: true,
  missingKeyHandler: false,
  missingInterpolationHandler: false,
  postProcess: false,
  returnNull: true,
  returnEmptyString: true,
  returnObjects: false,
  joinArrays: false,
  returnedObjectHandler: [Function: returnedObjectHandler],
  parseMissingKeyHandler: false,
  appendNamespaceToMissingKey: false,
  appendNamespaceToCIMode: false,
  overloadTranslationOptionHandler: [Function: handle],
  interpolation:
   { escapeValue: true,
     format: [Function: format],
     prefix: '{{',
     suffix: '}}',
     formatSeparator: ',',
     unescapePrefix: '-',
     nestingPrefix: '$t(',
     nestingSuffix: ')',
     maxReplaces: 1000 } }
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
i18next::backendConnector: No backend was added via i18next.use. Will not load resources.
success Building static HTML for pages — 0.359 s — 15/15 116.45 pages/second
Generated public/sw.js, which will precache 9 files, totaling 216241 bytes.
info Done building in 3.985 sec
info gatsby serve running at: http://localhost:9000/
situplastik commented 5 years ago

The problem is that you use the plugin with option debug: true (I guess). I had the same problem and changing to debug: false solve the issue (at least for me).

The real problem is that there's a backend problem with i18next plugin configuration. On the plugin, there's no backend connected to i18n. I tried to solve it but i don't know how make PR with some setupI18next.js modification:

import Backend from "i18next-xhr-backend" ..... i18next .use(Backend) .init({ .....

Here an example of implementing i18next on Gatsby with the backend lines:

https://www.gatsbyjs.org/blog/2017-10-17-building-i18n-with-gatsby/#setting-up

Could anyone explain me how can I do a PR? Thanks!