Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A tiny hook to manage translations in your React Application

NotificationsYou must be signed in to change notification settings

rmdort/tinytranslate

Repository files navigation

A tiny hook to manage translations in your React Application

MIT licensenode workflow

Features

  1. Support for deeply nested objects. Eg:translate('profile.top.heading')
  2. 100% Test coverage
  3. Fully controlled and stateless

Install

yarn add tinytranslateORnpm i tinytranslate --save

Usage

  1. Define your translations
consttranslations={en:{locale:"en-US",messages:{hello:"Hello {name}",},},};
  1. Add TranslationProvider to your app
import{TranslationProvider}from"tinytranslate";constApp=()=>{return(<TranslationProvidertranslations={translations}locale="en"><Header/></TranslationProvider>);};
  1. Use useTranslation hook
import{useTranslation}from'tinytranslate'constHeader=()=>{consttranslate=useTranslation()return<>{translate('hello'}</>}

About

A tiny hook to manage translations in your React Application

Topics

Resources

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp