ekoozu 0 Posted July 20 Hey, I'm trying to load i18next on client-side but it doesn't work, here is what i am doing: I downloaded the i18next script: https://unpkg.com/i18next/dist/umd/i18next.js Put in client_packages And trying to load like that: const i18next = require('./plugins/i18next'); // languages import en from 'lang/en'; i18next.init({ lng: 'en', resources: { en, } }); But it says i18next.init is not a function, i tried doing that with a simple node script and it worked, i know that clientside doesn't run on node, but shouldn't this work? Appreciate any help, thanks. Share this post Link to post Share on other sites
TheMysteriousVincent 20 Posted July 21 (edited) I guess you simply do not `require` the file at all. Try appending `.js` to "i18next" Edited July 21 by TheMysteriousVincent Share this post Link to post Share on other sites
ekoozu 0 Posted July 21 (edited) Hey, thanks for the reply. Appending .js doesn't seem to change anything, the file seems to be importing, because if i change the path it says `Error: could not locate file`. But for some reason on rage it doesn't seem to import the data from the file, i made this script to test (node index.js) and it works. const i18next = require('./i18next'); i18next.init({ lng: 'en', debug: false, resources: { en: { translation: { "key": "hello world" } } } }, function(err, t) { console.log(i18next.t('key')); }); This is the error RAGE returns: Maybe the way i18next is exported doesn't work on rage? Is there a way to make it work? Thanks. Edited July 21 by ekoozu Share this post Link to post Share on other sites
LeonMrBonnie 5 Posted July 26 Clientside is only Javascript, not NodeJS. Share this post Link to post Share on other sites
ekoozu 0 Posted July 27 (edited) I know, this package doesn't need node specifically. EDIT: Figured out how to do it, if anyone needs: Just use require('./i18next'); once in the client-side and it will give you the i18next variable globally. Edited July 28 by ekoozu Share this post Link to post Share on other sites
Jengas 16 Posted July 29 Seems that you are requiring it wrong. Please check documentation Share this post Link to post Share on other sites
ynhhoJ 27 Posted July 29 http://i18njs.com/#extensions Try that, for me it works some time ago.. Share this post Link to post Share on other sites
Jengas 16 Posted July 29 6 минут назад, ynhhoJ сказал: http://i18njs.com/#extensions Try that, for me it works some time ago.. Yep, that's good Share this post Link to post Share on other sites
ynhhoJ 27 Posted July 29 17 минут назад, Jengas сказал: Yep, that's good Thx! :3 Share this post Link to post Share on other sites