1.0.5 • Published 11 months ago

next-i18next-typesafe v1.0.5

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

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

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago

0.0.2

11 months ago

0.0.1

11 months ago