Socket
Socket
Sign inDemoInstall

i18next-prisma-backend

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next-prisma-backend

Use i18next with Prisma ORM as backend


Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

i18next Prisma backend plugin

A backend plugin for i18next that supports using Prisma to load resources from the data source specified in the schema.prisma configuration file.

Getting Started

Install packages

This package expects the Prisma Client as a peer dependency.

npm

npm install @prisma/client i18next-prisma-backend

yarn

yarn add @prisma/client i18next-prisma-backend

Update your Schema

Update your schema.prisma files to include the following model with a minimum of the following fields:

model i18n {
  namespace   String
  language    String
  key         String
  translation String

  @@id([key, language])
  @@index([language, translation])
}

You may use @@map and @map to specify the underlying database table and field names respectively. The plugin will expect this model to exist.

Apply the schema changes to your database.

Usage

This library supports ESM and CommonJS.

ESM

import i18next from "i18next";
import Backend from "i18next-prisma-backend";

i18next.use(Backend).init({
  // Backend Options
  backend: options
});

CommonJS

const i18next = require("i18next");
const Backend = require("i18next-prisma-backend");

i18next.use(Backend).init({
  // Backend Options
  backend: options
});

Backend Options

{
  // Optional: If you have an existing client instance,
  // you can specifiy it here. Otherwise a new instance
  // will be instanciated.
  client: prisma; // PrismaClient() instance
}

📝 License

Copyright © 2023 Aydrian Howard.
This project is MIT licensed.

Keywords

FAQs

Package last updated on 26 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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