New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

remix-i18next

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remix-i18next - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

browser/lib/get-client-locales.d.ts

6

browser/server.d.ts

@@ -89,8 +89,8 @@ import type { Cookie, EntryContext, SessionStorage } from "@remix-run/server-runtime";

* @param requestOrLocale The request object or the locale string already detected
* @param namespace The namespace to use for the T function
* @param namespaces The namespaces to use for the T function. (Default: `translation`).
* @param options The i18next init options
*/
getFixedT(locale: string, namespace?: string, options?: Omit<InitOptions, "react">): Promise<TFunction>;
getFixedT(request: Request, namespace?: string, options?: Omit<InitOptions, "react">): Promise<TFunction>;
getFixedT(locale: string, namespaces?: string | readonly string[], options?: Omit<InitOptions, "react">): Promise<TFunction>;
getFixedT(request: Request, namespaces?: string | readonly string[], options?: Omit<InitOptions, "react">): Promise<TFunction>;
private createInstance;
}
import { pick } from "accept-language-parser";
import { createInstance, } from "i18next";
import { getClientLocales } from "remix-utils";
import { getClientLocales } from "./lib/get-client-locales";
export class RemixI18Next {

@@ -49,3 +49,7 @@ constructor(options) {

}
async getFixedT(requestOrLocale, namespace = "translation", options = {}) {
async getFixedT(requestOrLocale, namespaces, options = {}) {
// Make sure there's at least one namespace
if (!namespaces || namespaces.length === 0) {
namespaces = "translation";
}
let [instance, locale] = await Promise.all([

@@ -55,4 +59,4 @@ this.createInstance({

...options,
fallbackNS: namespace,
defaultNS: namespace,
fallbackNS: namespaces,
defaultNS: typeof namespaces === "string" ? namespaces : namespaces[0],
}),

@@ -64,4 +68,4 @@ typeof requestOrLocale === "string"

await instance.changeLanguage(locale);
await instance.loadNamespaces(namespace);
return instance.getFixedT(locale, namespace);
await instance.loadNamespaces(namespaces);
return instance.getFixedT(locale, namespaces);
}

@@ -68,0 +72,0 @@ async createInstance(options = {}) {

@@ -89,8 +89,8 @@ import type { Cookie, EntryContext, SessionStorage } from "@remix-run/server-runtime";

* @param requestOrLocale The request object or the locale string already detected
* @param namespace The namespace to use for the T function
* @param namespaces The namespaces to use for the T function. (Default: `translation`).
* @param options The i18next init options
*/
getFixedT(locale: string, namespace?: string, options?: Omit<InitOptions, "react">): Promise<TFunction>;
getFixedT(request: Request, namespace?: string, options?: Omit<InitOptions, "react">): Promise<TFunction>;
getFixedT(locale: string, namespaces?: string | readonly string[], options?: Omit<InitOptions, "react">): Promise<TFunction>;
getFixedT(request: Request, namespaces?: string | readonly string[], options?: Omit<InitOptions, "react">): Promise<TFunction>;
private createInstance;
}

@@ -6,3 +6,3 @@ "use strict";

const i18next_1 = require("i18next");
const remix_utils_1 = require("remix-utils");
const get_client_locales_1 = require("./lib/get-client-locales");
class RemixI18Next {

@@ -53,3 +53,7 @@ constructor(options) {

}
async getFixedT(requestOrLocale, namespace = "translation", options = {}) {
async getFixedT(requestOrLocale, namespaces, options = {}) {
// Make sure there's at least one namespace
if (!namespaces || namespaces.length === 0) {
namespaces = "translation";
}
let [instance, locale] = await Promise.all([

@@ -59,4 +63,4 @@ this.createInstance({

...options,
fallbackNS: namespace,
defaultNS: namespace,
fallbackNS: namespaces,
defaultNS: typeof namespaces === "string" ? namespaces : namespaces[0],
}),

@@ -68,4 +72,4 @@ typeof requestOrLocale === "string"

await instance.changeLanguage(locale);
await instance.loadNamespaces(namespace);
return instance.getFixedT(locale, namespace);
await instance.loadNamespaces(namespaces);
return instance.getFixedT(locale, namespaces);
}

@@ -157,3 +161,3 @@ async createInstance(options = {}) {

async fromHeader(request) {
let locales = (0, remix_utils_1.getClientLocales)(request);
let locales = (0, get_client_locales_1.getClientLocales)(request);
if (!locales)

@@ -160,0 +164,0 @@ return null;

{
"name": "remix-i18next",
"version": "4.0.0",
"version": "4.1.0",
"description": "The easiest way to translate your Remix apps",

@@ -44,3 +44,3 @@ "license": "MIT",

"i18next": "^21.3.3",
"react": "^17.0.2",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-i18next": "^11.13.0"

@@ -50,35 +50,35 @@ },

"accept-language-parser": "^1.5.0",
"lru-cache": "^7.7.1",
"remix-utils": "^2.11.1",
"intl-parse-accept-language": "^1.0.0",
"lru-cache": "^7.10.0",
"use-consistent-value": "^1.0.0"
},
"devDependencies": {
"@remix-run/dev": "^1.0.0",
"@remix-run/node": "^1.0.0",
"@remix-run/react": "^1.0.0",
"@remix-run/server-runtime": "^1.0.0",
"@types/accept-language-parser": "^1.5.2",
"@types/lru-cache": "^7.5.0",
"@types/node": "^17.0.23",
"@types/prop-types": "^15.7.4",
"@types/react": "^17.0.14",
"@typescript-eslint/eslint-plugin": "^5.16.0",
"@typescript-eslint/parser": "^5.16.0",
"eslint": "^8.12.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-cypress": "^2.11.3",
"eslint-plugin-import": "^2.22.1",
"@remix-run/dev": "^1.4.3",
"@remix-run/node": "^1.4.3",
"@remix-run/react": "^1.4.3",
"@remix-run/server-runtime": "^1.4.3",
"@types/accept-language-parser": "^1.5.3",
"@types/lru-cache": "^7.6.1",
"@types/node": "^17.0.32",
"@types/prop-types": "^15.7.5",
"@types/react": "^18.0.9",
"@typescript-eslint/eslint-plugin": "^5.23.0",
"@typescript-eslint/parser": "^5.23.0",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest-dom": "^4.0.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^6.0.0",
"eslint-plugin-testing-library": "^5.1.0",
"eslint-plugin-unicorn": "^41.0.1",
"i18next": "^21.3.3",
"prettier": "^2.3.2",
"react": "^17.0.2",
"react-i18next": "^11.13.0",
"eslint-plugin-testing-library": "^5.5.0",
"eslint-plugin-unicorn": "^42.0.0",
"i18next": "^21.8.1",
"prettier": "^2.6.2",
"react": "^18.1.0",
"react-i18next": "^11.16.9",
"ts-node": "^10.7.0",
"typescript": "^4.3.5",
"vitest": "^0.9.3"
"typescript": "^4.6.4",
"vitest": "^0.12.4"
}
}

@@ -19,3 +19,3 @@ # remix-i18next

```sh
npm install remix-i18next i18next react-i18next i18next-http-backend i18next-fs-backend
npm install remix-i18next i18next react-i18next i18next-http-backend i18next-fs-backend i18next-browser-languagedetector
```

@@ -30,3 +30,3 @@

import { resolve } from "node:path";
import { RemixI18Next } from "~/lib/i18next/server";
import { RemixI18Next } from "remix-i18next";

@@ -64,3 +64,3 @@ export let i18n = new RemixI18Next({

import { I18nextProvider, initReactI18next } from "react-i18next";
import { getNamespaces } from "./lib/i18next/client";
import { getInitialNamespaces } from "remix-i18next";

@@ -80,3 +80,3 @@ i18next

// and pass them here to load the translations
ns: getNamespaces(),
ns: getInitialNamespaces(),
backend: { loadPath: "/locales/{{lng}}/{{ns}}.json" },

@@ -212,3 +212,3 @@ detection: {

return (
<html lang={lang} dir={i18n.dir()}>
<html lang={locale} dir={i18n.dir()}>
<head>

@@ -215,0 +215,0 @@ <Meta />

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc