0.0.6 • Published 5 years ago

@choffmeister/react-i18next-loader v0.0.6

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

react-i18next-loader

Usage

// App.i18n
{
  "message": {
    "text": {
      "en": "Field",
      "de": "Feld"
    }
  }
}
// App.jsx
import React from 'react'
import { useTranslation } from './App.i18n'

export const App = () => {
  const { t } = useTranslation()
  return (
    <div>{t('message.text')}</div>
  )
}

Configuration

// webpack.config.js
module.exports = {
  module: {
    rules: [
      {
        test: /\.i18n$/,
        use: [{ loader: '@choffmeister/react-i18next-loader' }],
      },
    ],
  },
}
// lib.d.ts
declare module '*.i18n' {
  import { UseTranslationResponse } from 'react-i18next'
  export const namespace: string
  export const translations: any
  export const useTranslation: () => UseTranslationResponse
}
0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago