Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Nov 22, 2024
1 parent 0b4bb09 commit 236da23
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ i18n
})
```

# If set i18next initImmediate option to false it will load the files synchronously
# If set i18next initAsync option to false it will load the files synchronously

```js
// i18n.js
Expand All @@ -121,7 +121,7 @@ i18next
.use(Backend)
.init({
// debug: true,
initImmediate: false,
initAsync: false,
fallbackLng: 'en',
lng: 'en',
preload: readdirSync(join(__dirname, '../locales')).filter((fileName) => {
Expand Down
4 changes: 2 additions & 2 deletions example/deno/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Backend from 'https://deno.land/x/i18next_fs_backend/index.js'
// import Backend from '../../lib/index.js'

i18next.use(Backend).init({
// initImmediate: false,
// initAsync: false,
lng: 'en',
fallbackLng: 'en',
preload: ['en', 'de'],
Expand All @@ -20,6 +20,6 @@ i18next.use(Backend).init({
console.log(t('welcome'))
console.log(t('welcome', { lng: 'de' }))
})
// this will only work if initImmediate is set to false, because it's async
// this will only work if initAsync is set to false, because it's async
console.log(i18next.t('welcome'))
console.log(i18next.t('welcome', { lng: 'de' }))
4 changes: 2 additions & 2 deletions example/fastify/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fastify from 'fastify'
import pov from 'point-of-view'
import pov from '@fastify/view'
import pug from 'pug'
import { register, i18next } from './lib/i18n.js'
import mail from './lib/mail.js'
Expand Down Expand Up @@ -32,7 +32,7 @@ app.get('/', (request, reply) => {

if (import.meta.url === `file://${process.argv[1]}`) {
// called directly
app.listen(port, (err) => {
app.listen({ port }, (err) => {
if (err) return console.error(err)
console.log(i18next.t('server.started', { port }))
console.log(i18next.t('server.started', { port, lng: 'de' }))
Expand Down
2 changes: 1 addition & 1 deletion example/fastify/lambda.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import awsLambdaFastify from 'aws-lambda-fastify'
import awsLambdaFastify from '@fastify/aws-lambda'
import app from './app.js'
export const handler = awsLambdaFastify(app)
2 changes: 1 addition & 1 deletion example/fastify/lib/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ i18next
.use(Backend)
.init({
// debug: true,
initImmediate: false, // setting initImediate to false, will load the resources synchronously
initAsync: false, // setting initImediate to false, will load the resources synchronously
fallbackLng: 'en',
preload: readdirSync(localesFolder).filter((fileName) => {
const joinedPath = join(localesFolder, fileName)
Expand Down
14 changes: 7 additions & 7 deletions example/fastify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"deploy": "npm run cf_package && npm run cf_deploy"
},
"dependencies": {
"aws-lambda-fastify": "1.7.0",
"fastify": "3.29.4",
"i18next": "20.3.2",
"i18next-fs-backend": "1.1.1",
"i18next-http-middleware": "3.1.4",
"mjml": "4.10.1",
"point-of-view": "4.15.0",
"@fastify/aws-lambda": "5.0.0",
"fastify": "5.1.0",
"i18next": "24.0.0",
"i18next-fs-backend": "2.5.0",
"i18next-http-middleware": "3.6.0",
"mjml": "4.15.3",
"@fastify/view": "10.0.1",
"pug": "3.0.3"
}
}
4 changes: 2 additions & 2 deletions example/node/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const i18next = require('i18next')
const Backend = require('../../cjs')

i18next.use(Backend).init({
// initImmediate: false,
// initAsync: false,
lng: 'en',
fallbackLng: 'en',
preload: ['en', 'de'],
Expand All @@ -17,6 +17,6 @@ i18next.use(Backend).init({
console.log(t('welcome'))
console.log(t('welcome', { lng: 'de' }))
})
// this will only work if initImmediate is set to false, because it's async
// this will only work if initAsync is set to false, because it's async
console.log(i18next.t('welcome'))
console.log(i18next.t('welcome', { lng: 'de' }))
2 changes: 1 addition & 1 deletion example/node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"type": "commonjs",
"dependencies": {
"i18next": "23.16.6"
"i18next": "24.0.0"
}
}
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Backend {
loadPath = this.options.loadPath(language, namespace)
}
const filename = this.services.interpolator.interpolate(loadPath, { lng: language, ns: namespace })
if (this.allOptions.initImmediate === false) {
if (this.allOptions.initAsync === false) {
try {
const { data, stat } = readFileSync(filename, this.options)
const timestamp = stat && stat.mtime && stat.mtime.getTime()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"eslint-plugin-require-path-exists": "1.1.9",
"eslint-plugin-standard": "5.0.0",
"expect.js": "0.3.1",
"i18next": "23.16.6",
"i18next": "24.0.0",
"js-yaml": "4.1.0",
"jsonc-parser": "3.3.1",
"json5": "2.2.3",
Expand Down

0 comments on commit 236da23

Please sign in to comment.