I have a worker running a Discord bot and want to start building up i18n for it. I have structure set up, but need a way to load the json lang files. If anything I may just fall back to a basic include and change up the files slightly.
TIL this isn't Node.js, but "workerd". So fs.readFileSync isn't available.
I tried reading over this blog post but it along with my messed up sleep is making my brain hurt. It's not making any sense. not sure if it's even relatable or not.
https://blog.cloudflare.com/more-npm-packages-on-cloudflare-workers-combining-polyfills-and-native-code/
I have files at:
./src/api/i18n/en-US.json./src/api/i18n/es-ES.json./src/api/i18n/it.json- etc.
Main entry is at ./src/api/server.js so it just refers to ./i18n/{lang}.json