Closed haf closed 5 years ago
Something like this? https://github.com/i18next/react-i18next/tree/master/example/react/src + locize settings: https://github.com/i18next/react-i18next/blob/master/example/v9.x.x/locize/src/i18n.js
@adrai Yes exactly that; I was avoiding older samples, but there it is.
Are there any details on how to set up a CI/CD pipeline with locize?
You have the possibility to use the cli (https://github.com/locize/locize-cli) or directly the api (https://docs.locize.com/integration/api).
And there are also webhooks (https://docs.locize.com/integration/webhook), slack (https://docs.locize.com/more/notifications), the saveMissing feature of i18next (https://www.i18next.com/overview/configuration-options#missing-keys), last used plugin (https://github.com/locize/locize-lastused), in-context-editor (https://docs.locize.com/more/incontext-editor), etc... 😉
Ok, last question (promise!) the above but with next-i18next
—next.js support as well? next-i18next doesn't really expose its i18n configuration in its sample.
https://github.com/isaachinman/next-i18next/blob/master/src/create-i18next-client.js#L30 there seems to be a use
array you can pass for configuration
@jamuhl I tried; the problem is that I have to conditionally only give it if it's running on the server.
EDIT:
// https://github.com/i18next/react-i18next/tree/master/example/v9.x.x/locize
const defaultConfig = {
defaultLanguage: 'en',
otherLanguages: ['sv'],
use: process.browser ? [] : [ require('i18next-node-locize-backend') ]
}
works, but it's badly configured and crashes when trying to read an absolute path:
Error: Invalid URI "/Users/h/dev/qv2/static/locales/en/common.json"
looks more like the default setting for the i18next-fs-backend triggers here -> did you pass in the backend settings for the i18next-node-locize-backend?
I've tried both as a property backend
on the config object, and
both throw the above error.
I would ask how to do it properly at the next-i18next repo - @isaachinman for sure will help you out with this.
Alternative just sync your translations to the express server using our CLI: https://github.com/locize/locize-cli#download-current-published-files
This all now works with these keys in config:
and these in backend:
Thanks for helping me getting it working. If you want to track this issue as "add a react sample", feel free to reopen.
Did you manage to use in context editor with NextJS?
Did you manage to use in context editor with NextJS?
just use it like this: https://github.com/locize/next-i18next-locize/blob/main/next-i18next.config.js#L27
Hi,
Do you have a sample with i18next and latest react that doesn't use globals/window.locize? I would like to bundle everything with webpack.
Regards,