@unvented/translate
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

@unvented/translate

Installation

npm i @unvented/translate

Usage

// de.json
{
  "welcomeMessage": "Hallo {name}",
  "a": {
    "very": {
      "deep": {
        "translation": "Irgendwas"
      }
    }
  }
}
// en.json
{
  "welcomeMessage": "Hello {name}",
  "a": {
    "very": {
      "deep": {
        "translation": "Something"
      }
    }
  }
}
import { useTranslate } from '@unvented/translate'
import de from './de.json'
import en from './en.json'

const translate = useTranslate({ de, en }, '<currentLocale>' /* e.g. 'de' */, '<fallbackLocale>' /* e.g. 'en' */)

, translationOne = translate('welcomeMessage', { name: 'Samuel' }) // Hallo Samuel
, translationTwo = translate('a.very.deep.translation') // Irgendwas

/@unvented/translate/

    Package Sidebar

    Install

    npm i @unvented/translate

    Weekly Downloads

    0

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    3.63 kB

    Total Files

    5

    Last publish

    Collaborators

    • boywithkeyboard