Automaticaly detect browser language. Use the detectLocale provider prop.
Ability to provide custom locale pattern (default is still xx_XX)
New provider props, locales and initialLocale
Changed
Split useLittera into two hooks (useLittera and useLitteraMethods)
Change provider props naming. Language is now called locale etc.
Migration 1.X => 2.X
The migration process is straightforward. You have to rename some properties and change the way you use useLittera.
Changed naming
language => locale
setLanguage => setLocale
Mainly pay attention to LitteraProvider and withLittera props naming.
LitteraProvider changes
The provider accepts 2 new props locales: string[] and initialLocale?: string. You don't need to use your own state from now, the provider will handle it by itself. That makes the locale and setLocale props not required.
Changelog
All notable changes for this version.
Added
detectLocale
provider prop.locales
andinitialLocale
Changed
Migration 1.X => 2.X
The migration process is straightforward. You have to rename some properties and change the way you use
useLittera
.Changed naming
language
=>locale
setLanguage
=>setLocale
Mainly pay attention to
LitteraProvider
andwithLittera
props naming.LitteraProvider changes
The provider accepts 2 new props
locales: string[]
andinitialLocale?: string
. You don't need to use your own state from now, the provider will handle it by itself. That makes thelocale
andsetLocale
props not required.useLittera changes
The hook returns only the translated object now. Use
useLitteraMethods
to get/set locale, set pattern etc.