2.0.1 • Published 3 months ago

@boutdecode/i18n v2.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

I18N tools by Bout de code

https://boutdecode.fr

Bout de code - Développement de site internet et blog avec de vrais morceaux de codes, simples, élégants, utiles (parfois) et surtout sans fioriture.

Installation

$ npm install @boutdecode/i18n

Yion plugin

For yion :

Before create translation files like :

whatever.<lang>.json|js

Example :

/translations
  messages.en.json
  messages.fr.json

Finally

const { createApp, createServer } = require('@boutdecode/yion')
const i18nPlugin = require('@boutdecode/i18n')

const app = createApp()
const server = createServer(app)

app.use(i18nPlugin({
  locale: 'en', // Default locale
  folder: 'translations' // Folder where translation files are located
}))

app.get('/', ({ i18n }) => {
  i18n.locale // Current locale, null if not detected
  i18n.t('hello') // translate hello
})

server.listen(8080)

Tests

$ npm run test
1.0.0

3 months ago

2.0.1

3 months ago

2.0.0

3 months ago

1.3.0

8 months ago

1.2.0

11 months ago

1.1.1

11 months ago

1.1.0

11 months ago