Gathering detailed insights and metrics for i18next-http-backend
Gathering detailed insights and metrics for i18next-http-backend
Gathering detailed insights and metrics for i18next-http-backend
Gathering detailed insights and metrics for i18next-http-backend
i18next-http-middleware
i18next-http-middleware is a middleware to be used with Node.js web frameworks like express or Fastify and also for Deno.
@skyra/i18next-backend
A fast and modern filesystem-based i18next backend for Node.js.
i18next-http-payload-backend
i18next-http-backend is a backend layer for i18next using in Node.js, in the browser and for Deno.
@skyra/http-framework-i18n
An internationalization layer powered by i18next and @skyra/i18next-backend for @skyra/http-framework
i18next-http-backend is a backend layer for i18next using in Node.js, in the browser and for Deno.
npm install i18next-http-backend
Typescript
Module System
Node Version
NPM Version
97.9
Supply Chain
99
Quality
84
Maintenance
100
Vulnerability
100
License
JavaScript (70.11%)
HTML (14.68%)
TypeScript (9.37%)
Vue (4.31%)
CSS (1.45%)
Less (0.08%)
Total Downloads
147,008,415
Last Day
49,378
Last Week
1,359,625
Last Month
5,801,871
Last Year
56,845,684
MIT License
488 Stars
282 Commits
71 Forks
6 Watchers
1 Branches
29 Contributors
Updated on Jun 25, 2025
Minified
Minified + Gzipped
Latest Version
3.0.2
Package Id
i18next-http-backend@3.0.2
Unpacked Size
107.83 kB
Size
19.10 kB
File Count
23
NPM Version
10.9.2
Node Version
22.13.1
Published on
Jan 23, 2025
Cumulative downloads
Total Downloads
1
24
This is a simple i18next backend to be used in Node.js, in the browser and for Deno. It will load resources from a backend server using the XMLHttpRequest or the fetch API.
Get a first idea on how it is used in this i18next crash course video.
It's based on the deprecated i18next-xhr-backend and can mostly be used as a drop-in replacement.
Why i18next-xhr-backend was deprecated?
If you don't like to manage your translation files manually or are simply looking for a better management solution, take a look at i18next-locize-backend. The i18next backed plugin for 🌐 locize ☁️.
To see i18next-locize-backend in a working app example, check out:
Make sure you set the debug
option of i18next to true
. This will maybe log more information in the developer console.
Seeing failed http requests, like 404?
Are you using a language detector plugin that detects region specific languages you are not providing? i.e. you provide 'en'
translations but you see a 'en-US'
request first?
This is because of the default load
option set to 'all'
.
Try to set the load
option to 'languageOnly'
1i18next.init({ 2 load: 'languageOnly', 3 // other options 4})
Source can be loaded via npm or downloaded from this repo.
There's also the possibility to directly import it via a CDN like jsdelivr or unpkg or similar.
1# npm package 2$ npm install i18next-http-backend
Wiring up:
1import i18next from 'i18next'; 2import HttpApi from 'i18next-http-backend'; 3 4i18next.use(HttpApi).init(i18nextOptions);
for Deno:
1import i18next from 'https://deno.land/x/i18next/index.js' 2import Backend from 'https://deno.land/x/i18next_http_backend/index.js' 3 4i18next.use(Backend).init(i18nextOptions);
for plain browser:
1<script src="https://cdn.jsdelivr.net/npm/i18next-http-backend@1.3.1/i18nextHttpBackend.min.js"></script> 2<!-- an example can be found in example/jquery/index.html -->
1i18next.use(i18nextHttpBackend).init(i18nextOptions);
window.i18nextHttpBackend
1{ 2 // path where resources get loaded from, or a function 3 // returning a path: 4 // function(lngs, namespaces) { return customPath; } 5 // the returned path will interpolate lng, ns if provided like giving a static path 6 // the function might return a promise 7 // returning falsy will abort the download 8 // 9 // If not used with i18next-multiload-backend-adapter, lngs and namespaces will have only one element each, 10 // If used with i18next-multiload-backend-adapter, lngs and namespaces can have multiple elements 11 // and also your server needs to support multiloading 12 // /locales/resources.json?lng=de+en&ns=ns1+ns2 13 // Adapter is needed to enable MultiLoading https://github.com/i18next/i18next-multiload-backend-adapter 14 // Returned JSON structure in this case is 15 // { 16 // lang : { 17 // namespaceA: {}, 18 // namespaceB: {}, 19 // ...etc 20 // } 21 // } 22 loadPath: '/locales/{{lng}}/{{ns}}.json', 23 24 // path to post missing resources, or a function 25 // function(lng, namespace) { return customPath; } 26 // the returned path will interpolate lng, ns if provided like giving a static path 27 // 28 // note that this only works when initialized with { saveMissing: true } 29 // (see https://www.i18next.com/overview/configuration-options) 30 addPath: '/locales/add/{{lng}}/{{ns}}', 31 32 // parse data after it has been fetched 33 // in example use https://www.npmjs.com/package/json5 34 // here it removes the letter a from the json (bad idea) 35 parse: function(data) { return data.replace(/a/g, ''); }, 36 37 // parse data before it has been sent by addPath 38 parsePayload: function(namespace, key, fallbackValue) { return { key: fallbackValue || "" } }, 39 40 // parse data before it has been sent by loadPath 41 // if value returned it will send a POST request 42 parseLoadPayload: function(languages, namespaces) { return undefined }, 43 44 // allow cross domain requests 45 crossDomain: false, 46 47 // allow credentials on cross domain requests 48 withCredentials: false, 49 50 // overrideMimeType sets request.overrideMimeType("application/json") 51 overrideMimeType: false, 52 53 // custom request headers sets request.setRequestHeader(key, value) 54 customHeaders: { 55 authorization: 'foo', 56 // ... 57 }, 58 // can also be a function, that returns the headers 59 customHeaders: () => ({ 60 authorization: 'foo', 61 // ... 62 }), 63 64 requestOptions: { // used for fetch, can also be a function (payload) => ({ method: 'GET' }) 65 mode: 'cors', 66 credentials: 'same-origin', 67 cache: 'default' 68 }, 69 70 // define a custom request function 71 // can be used to support XDomainRequest in IE 8 and 9 72 // 73 // 'options' will be this entire options object 74 // 'url' will be passed the value of 'loadPath' 75 // 'payload' will be a key:value object used when saving missing translations 76 // 'callback' is a function that takes two parameters, 'err' and 'res'. 77 // 'err' should be an error 78 // 'res' should be an object with a 'status' property and a 'data' property containing a stringified object instance beeing the key:value translation pairs for the 79 // requested language and namespace, or null in case of an error. 80 request: function (options, url, payload, callback) {}, 81 82 // adds parameters to resource URL. 'example.com' -> 'example.com?v=1.3.5' 83 queryStringParams: { v: '1.3.5' }, 84 85 reloadInterval: false // can be used to reload resources in a specific interval (milliseconds) (useful in server environments) 86}
Options can be passed in:
preferred - by setting options.backend in i18next.init:
1import i18next from 'i18next'; 2import HttpApi from 'i18next-http-backend'; 3 4i18next.use(HttpApi).init({ 5 backend: options, 6});
on construction:
1import HttpApi from 'i18next-http-backend'; 2const HttpApi = new HttpApi(null, options);
via calling init:
1import HttpApi from 'i18next-http-backend'; 2const HttpApi = new HttpApi(); 3HttpApi.init(null, options);
To properly type the backend options, you can import the HttpBackendOptions
interface and use it as a generic type parameter to the i18next's init
method, e.g.:
1import i18n from 'i18next' 2import HttpBackend, { HttpBackendOptions } from 'i18next-http-backend' 3 4i18n 5 .use(HttpBackend) 6 .init<HttpBackendOptions>({ 7 backend: { 8 // http backend options 9 }, 10 11 // other i18next options 12 })
From the creators of i18next: localization as a service - locize.com
A translation management system built around the i18next ecosystem - locize.com.
With using locize you directly support the future of i18next.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
4 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 5
Reason
Found 2/24 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
-6.3%
49,378
Compared to previous day
Last Week
-6.6%
1,359,625
Compared to previous week
Last Month
3.2%
5,801,871
Compared to previous month
Last Year
40%
56,845,684
Compared to previous year