Our great sponsors
- Appwrite - The open-source backend cloud platform
- Onboard AI - Learn any GitHub repo in 59 seconds
- InfluxDB - Collect and Analyze Billions of Data Points in Real Time
-
i18next-fs-backend
i18next-fs-backend is a backend layer for i18next using in Node.js and for Deno to load translations from the filesystem.
Alternatively, use i18next-locize-backend instead of the i18next-fs-backend. If you're running your code in a serverless environment, make sure you read this advice first!
-
We will show some examples that uses i18next as i18n framework. If you're curious to know why we suggest i18next, have a look at this page.
-
Appwrite
Appwrite - The open-source backend cloud platform. Add Auth, Databases, Functions, and Storage to your product and build any application at any scale while using your preferred coding languages and tools.
-
Just use this cli to synchronize the translations with your code. To see how this could look like check out Step 1 in this tutorial.
-
This time we will use a different i18next module, i18next-http-middleware. It can be used for all Deno web frameworks, like abc or ServestJS, but also for Node.js web frameworks, like express or Fastify.
-
This time we will use a different i18next module, i18next-http-middleware. It can be used for all Deno web frameworks, like abc or ServestJS, but also for Node.js web frameworks, like express or Fastify.
-
// deno run --allow-net --allow-read index.js import { Application } from 'https://deno.land/x/abc/mod.ts' import { config } from "https://deno.land/x/dotenv/mod.ts" import { i18n, middleware } from './i18n.js' import { renderFile } from 'https://deno.land/x/dejs/mod.ts' const port = config.PORT || 8080 const app = new Application() app.renderer = { render(name, data) { return renderFile(`./views/${name}.html`, data) } } const handle = middleware.handle(i18n) app.use((next) => (c) => { handle(c) return next(c) } ) app.get('/', (c) => c.render('index', { t: c.request.t, i18n: c.request.i18n })) app.get('/raw', (c) => c.request.t('home.title')) app.start({ port }) console.log(i18n.t('server.started', { port })) console.log(i18n.t('server.started', { port, lng: 'de' })) console.log(i18n.t('server.started', { port, lng: 'it' }))
Related posts
- Is there an easy way to deploy Deno to production like for example Node to AWS Elastic Beanstalk? Or something in the works? I want to use deno in production on AWS Amazon.
- How does server side internationalization (i18n) look like?
- Best NodeJS frameworks for seamless backend development
- NestJS is now the most starred Node framework on GitHub
- Web Scraping with Cheerio, Axios, and Express