next-i18next-typesafe
v1.0.5
Published
[![npm version](https://badge.fury.io/js/next-i18next-typesafe.svg)](https://badge.fury.io/js/next-i18next-typesafe) [![npm](https://img.shields.io/npm/dw/next-i18next-typesafe.svg?logo=npm)](https://www.npmjs.com/package/next-i18next-typesafe) [![npm](ht
Downloads
7
Readme
i18next typesafe
Demo
Install
npm i next-i18next-typesafe@latest --save-dev
With yarn
yarn add next-i18next-typesafe@latest -D
Setup
Create file: i18n-typesafe.config.ts
or i18n-typesafe.config.mjs
or i18n-typesafe.config.js
import { defineConfig } from 'next-i18next-typesafe';
export default defineConfig({
input: 'public/locales/en/**/*.json',
output: 'src/i18n',
library: 'next-i18next' | 'react-i18next'
});
// Nextjs use next-i18next
// React use react-i18next
CLI (file package.json)
-p: Port
-w: Watch
-c: Config
{
...
"scripts": {
...
// development
"next-i18next-typesafe": "next-i18next-typesafe -w",
// OR
"next-i18next-typesafe-port": "next-i18next-typesafe -p 1234 -w",
},
...
}
Custom config file
- You can also use a custom config file instead of
i18n-typesafe.config.ts
. Just create<FILE_NAME>.config.ts
to build command
Exp: awesome.config.ts
{
...
"scripts": {
...
// development
"next-i18next-typesafe": "next-i18next-typesafe -w -c awesome",
// OR
"next-i18next-typesafe-port": "next-i18next-typesafe -p 1234 -w -c awesome",
},
...
}
Compile
npm run next-i18next-typesafe