next-i18next-typesafe
TypeScript icon, indicating that this package has built-in type declarations

1.0.5 • Public • Published

i18next typesafe

npm version npm npm All Contributors

Demo

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

Demo

demo

Package Sidebar

Install

npm i next-i18next-typesafe

Weekly Downloads

2

Version

1.0.5

License

MIT

Unpacked Size

13.8 kB

Total Files

8

Last publish

Collaborators

  • hunghg255