cra-template-demplate
Advanced tools
Comparing version 0.0.4 to 0.0.8
{ | ||
"name": "cra-template-demplate", | ||
"version": "0.0.4", | ||
"version": "0.0.8", | ||
"keywords": [ | ||
@@ -5,0 +5,0 @@ "react", |
import create from 'zustand'; | ||
import enWords from '@/assets/translates/en.json' | ||
import arWords from '@/assets/translates/ar.json' | ||
@@ -11,7 +9,5 @@ export enum Locale { | ||
const defaultLocale = Locale.EN; | ||
const defaultMessages = enWords; | ||
interface Store { | ||
locale: Locale; | ||
messages: Record<string, any>; | ||
setLocale: (locale: Locale) => void; | ||
@@ -22,16 +18,3 @@ } | ||
locale: defaultLocale, | ||
messages: defaultMessages, | ||
setLocale: (locale: Locale) => { | ||
let messages = {}; | ||
switch (locale) { | ||
case Locale.AR: | ||
messages = arWords; | ||
break | ||
default: | ||
case Locale.EN: | ||
messages = enWords; | ||
break; | ||
} | ||
set(state => ({locale, messages})) | ||
} | ||
setLocale: (locale: Locale) => set(state => ({locale})) | ||
})); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35481
399